Borrar filtros
Borrar filtros

logical array variables in a loop

1 visualización (últimos 30 días)
Peter P
Peter P el 17 de Sept. de 2019
Editada: madhan ravi el 17 de Sept. de 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!

Respuesta aceptada

madhan ravi
madhan ravi el 17 de Sept. de 2019
Editada: madhan ravi el 17 de Sept. de 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.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements 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!

Translated by