How to change string name being passed through function argument automatically?

4 views (last 30 days)
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')

Accepted Answer

Walter Roberson
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

More Answers (0)

Categories

Find more on Numeric Types 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!