How to change string name being passed through function argument automatically?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
camicat
el 27 de En. de 2020
Respondida: Walter Roberson
el 28 de En. de 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 comentarios
Respuesta aceptada
Walter Roberson
el 28 de En. de 2020
P = Table1.Properties.VariableNames;
for k = 1:length(P)
Name = P{k};
Value = Table1{:, k};
MyPlot(Name, Value);
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!