Saving values in a matrix

I would like to create a single matrix where every row will contain the values of A displayed at each loop. I have written the following program which displays the values of A which i want, however i would like to store all of those values as a matrix 10x10.
Thanks!
This is the code i have written which displays the values of A
n=0;
A=0;
k=0;
f=0;
while(n<10)
f=0;
while(f<10)
f=f+1;
k=k+1;
A(f)=k;
end
disp(A);
n=n+1;
end

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 3 日
編集済み: Azzi Abdelmalek 2013 年 2 月 3 日

0 投票

n=0;
A=zeros(10);
k=0;
while(n<10)
f=0;
n=n+1;
while(f<10)
f=f+1;
k=k+1;
A(n,f)=k;
end
end

カテゴリ

ヘルプ センター および File ExchangeAdvanced Evaluation and Exception Handling についてさらに検索

質問済み:

2013 年 2 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by