creating four arrays from two cell arrays?

1 回表示 (過去 30 日間)
Angira Mahida
Angira Mahida 2020 年 4 月 20 日
コメント済み: Angira Mahida 2020 年 4 月 20 日
Hello there,
I have table (79*13). I have 1st column have values from 1-79 named gates and 12th column have mixed values (positive and negative).
I need to plot x = all positive values and corresponding gates in Y axis, similar for all negative values in x-axis and corresponding gate number at Y-axis.
i have extracted positive and negative using sort command.(image attached)
but i don't know how to extract corresponding gate number into array to do plotting?

採用された回答

Mehmed Saad
Mehmed Saad 2020 年 4 月 20 日
A = gooddiff;
B = gatenumber;
Now Logical Indexing
pos = A<0;
neg = A>=0;
A_pos = A(pos);
A_neg = A(neg);
B_pos = B(pos);
B_neg = B(neg);
Now you can plot them
for sorting
[A_pos,inda] = sort(A_pos);
B_pos=B_pos(inda);
[A_neg,indb] = sort(A_neg);
B_neg=B_neg(indb);
  1 件のコメント
Angira Mahida
Angira Mahida 2020 年 4 月 20 日
hey Thank you so much. It is working perfectly just 'pos' is 'neg' and the alter. Thanks again :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by