logical array variables in a loop

2 ビュー (過去 30 日間)
Peter P
Peter P 2019 年 9 月 17 日
編集済み: madhan ravi 2019 年 9 月 17 日
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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by