How can I run matlab m file with arguments and handle that argument in m file? -
how can run matlab m file arguments?
can run same code in octave arguments not find corresponding code in matlab. after running m file on command line arguments, need handle argument in m file. here corresponding octave code works perfectly:
#! /usr/bin/octave -qf arglist = argv();
here command run above m file perfectly:
./solver.m this_is_argument_of_m_file
what corresponding matlab codes?
update: by command line, mean operating system command line(terminal, windows cmd), not matlab command line.
you should know there's difference between scripts , functions. mathworks had dedicated part of documentation difference.
script not take input arguments, functions can, don't need to. can recognize function first functional code in m-file function
. function uses own workspace, script uses matlab's base workspace.
for example:
function out = fcn_name(in1, in2, varargin)
furthermore, can program using oo in matlab, think should start reading link above.
for startup command please check this part of documentation. may want use -r
option.
Comments
Post a Comment