specifying an array size
1 回表示 (過去 30 日間)
古いコメントを表示
clear
count=1
A =randi([1,9999],10,31)
[row,col]=size(A)
for i=1: row
for j =1:col
%%to check if this number appears and then store than index in another
%%array
if A(i,j)==4000
b=[i,j]
count = count+1;
%% I would like to have the count as the amount of rows, and two columns for i and j
b=[,count;,;]
end
end
end
0 件のコメント
採用された回答
Chunru
2023 年 3 月 8 日
count=0;
b = [];
%A =randi([1,9999],10,31);
A =randi([1,60],10,31);
[row,col]=size(A);
for i=1: row
for j =1:col
%if A(i,j)==4000
if A(i,j)==10
count = count+1;
b=[b; count i,j];
end
end
end
b
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Operators and Elementary Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!