How to change string name being passed through function argument automatically?
1 view (last 30 days)
Show older comments
camicat
on 27 Jan 2020
Answered: Walter Roberson
on 28 Jan 2020
Hello!
I am currently creating line plots for several parameters (50+). All of the parameter data is stored in two tables (one with a column for each parameter and its numeric data and another with one colum listing each parameter and its associated limits). I would like to create a loop that allows me to pass all the parameters and their limits one by one so that I can output the plots. The problem I'm encountering is that I cannot figure out how to pull the string name from one table and pass those strings as a different function argument each time. I would like to avoid having to plot each parameter individually.
Examples of places where I would like to replace strings:
ind = find(strcmpi(Table1.Parameter, 'Parameter Name 1')
ylabel('Parameter Name 1')
title('Parameter Name 1')
0 Comments
Accepted Answer
Walter Roberson
on 28 Jan 2020
P = Table1.Properties.VariableNames;
for k = 1:length(P)
Name = P{k};
Value = Table1{:, k};
MyPlot(Name, Value);
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Characters and Strings 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!