logical array variables in a loop

2 次查看(过去 30 天)
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!

采纳的回答

madhan ravi
madhan ravi 2019-9-17
编辑:madhan ravi 2019-9-17
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by