help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pass sting as function argument?


From: Ben Abbott
Subject: Re: pass sting as function argument?
Date: Fri, 19 Sep 2008 18:59:03 -0400


On Sep 19, 2008, at 5:48 PM, cube1982 wrote:

function mat2txt(matfilename, textfilename)
tmpfile = load (matfilename);
vars = fieldnames (tmpfile);
load (matfilename);
save ('-text', textfilename, vars{:});
endfunction

That works great!! Thanks Ben! By the way, what does vars{:} do? Would you point me to somewhere I can find information about this if you are not able to spend time on this topic. Any keywords or terms I should search for?

Thanks again

"vars" is a cell array of strings.

(vars{:}) is equivalent to (vars{1}, vars{2}, vars{3}, vars{4}, ... ,vars{end})

It is a very nice feature/trick!

Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]