Having array trouble
古いコメントを表示
i'm having trouble on manipulating the array form. according to the code below, i try to save the result inform of array so that it can be call outside the loop. but the size of or each row are different and the error appeared as:
Error using vertcat
CAT arguments dimensions are not consistent.
clear; clc;
DG = [0 1 0 0 0; 0 0 1 1 1; 0 0 0 0 1; 0 0 0 0 1; 0 0 0 0 0]
save=[];
for i = 1:5
child = find(DG(i,:))
save = [save; child];
end
can anyone help me to correct this problem, i'm really appreciate it. thank you..
3 件のコメント
Andrei Bobrov
2012 年 4 月 3 日
save1 = arrayfun(@(x)find(DG(x,:)),(1:size(DG,1)).','un',0)
reez all
2012 年 4 月 4 日
Andrei Bobrov
2012 年 4 月 4 日
save1{:}
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!