フィルターのクリア

how can i choose a certain row from simulation?

1 回表示 (過去 30 日間)
arkedia
arkedia 2013 年 1 月 16 日
i make a simulation it's results is a matrix so, if the run =500, i'll have 500 matrix my quistion is..........i want to choose certain row from those martrces the row is .....[xxx 1 0 0 0]...note xxx means the existing number it's different from matrix to another
  3 件のコメント
arkedia
arkedia 2013 年 1 月 16 日
編集済み: Jan 2013 年 1 月 16 日
matrix one [18 1 0 0 0;15 1 0 1 0;20 0 0 0 1]
matrix two [30 1 0 0 0;20 1 0 1 0;50 0 1 0 0]
matrix three [10 1 0 1 0;20 1 0 0 0;40 0 0 1 0]
...the new matrix i want consists of [18 1 0 0 0;30 1 0 0 0;20 1 0 0 0]
Jan
Jan 2013 年 1 月 16 日
I do not see the relation between the three input arrays and the output. Please explain the procedure with all required details. Do not use explanations as "matrix one", but the valid Matlab syntax like "A= [...]". It is unclear in which format you store the 500 matrices, but this detail matters.

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

採用された回答

José-Luis
José-Luis 2013 年 1 月 16 日
your_mat = [18 1 0 0 0;...
15 1 0 1 0;...
20 0 0 0 1];
idxFun = @(x) find(ismember(x(:,2:end),[1 0 0 0],'rows'));
your_row = your_mat(idxFun(your_mat),:);
Then you can concatenate:
your_result = [your_row1;your_row2;your_row3];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by