How to change string name being passed through function argument automatically?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
camicat
le 27 Jan 2020
Réponse apportée : Walter Roberson
le 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 commentaires
Réponse acceptée
Walter Roberson
le 28 Jan 2020
P = Table1.Properties.VariableNames;
for k = 1:length(P)
Name = P{k};
Value = Table1{:, k};
MyPlot(Name, Value);
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Numeric Types dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!