Perform a function on a sequence of Variables
2 views (last 30 days)
Show older comments
how does one perform the same function on a sequence of variables?
0 Comments
Answers (1)
Image Analyst
on 31 Mar 2015
Just call the function, passing in each of the variables.
out1 = YourFunction(var1);
out2 = YourFunction(var2);
out3 = YourFunction(var3);
out4 = YourFunction(var4);
out5 = YourFunction(var5);
2 Comments
Image Analyst
on 31 Mar 2015
They're in an array, right. Surely you don't have several thousand variables all with unique names ? That would be stupendously unwise.
for k = 1 : numel(m)
out(k) = YourFunction(m(k));
end
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!