Info
この質問は閉じられています。 編集または回答するには再度開いてください。
how to change this code to search on column ?
2 ビュー (過去 30 日間)
古いコメントを表示
A=[ 0 0 1 0 1 0 1 4 1 0
10 10 6 5 1 1 1 5 6 10 ]
a=[ 10 10 7 5 2 1 2 9 7 10 ]
b = [1 1 2 1 2 1 2 2 2 1 ]
this code to row i want to change it for column
N = 10;
m = size(A,1);
% Pre-allocate the F_Complete matrix
F_Complete = zeros(m, N)
for i = 1:m
if a(i)+b(i)-1 == 10
tempVector = [ones(1,A(i,1)) 0 ones(1,A(i,2)) 0 ones(1,A(i,3))];
F_Complete(i,:) = tempVector(1:N);
end
end
to produce this solution
F_complete = [ 1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 0 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1 ]
2 件のコメント
Image Analyst
2016 年 4 月 30 日
Explain in words, what conditions would you like a column of F_complete to have a 1 at a particular row?
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!