logical array variables in a loop

1 Ansicht (letzte 30 Tage)
Peter P
Peter P am 17 Sep. 2019
Bearbeitet: madhan ravi am 17 Sep. 2019
I have variables 'filter_X' that include only logical arrays:
filter_p = outlier & incl_p;
filter_r = outlier & incl_r;
filter_p_r = outlier & incl_p_r;
now I want to plot (seperated plots) all three examples below with a loop.
plot(A(filter_p), B(filter_p), 'ro')
plot(A(filter_r), B(filter_r), 'ro')
plot(A(filter_p_r), B(filter_p_r), 'ro')
Any suggestions? Thanks in advance!

Akzeptierte Antwort

madhan ravi
madhan ravi am 17 Sep. 2019
Bearbeitet: madhan ravi am 17 Sep. 2019
It would been simpler if they were stored in a cell array:
c{1} = outlier & incl_p;
c{2}= outlier & incl_r;
c{3} = outlier & incl_p_r;
Note: Naming variables is a bad idea ( https://in.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval ). Loop through c to get three different figures with a figure call.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by