Question on Numbering A1 - An?
2 ビュー (過去 30 日間)
古いコメントを表示
how do i make the syntax for looping to have an output of A1, A2, A3, A4... A(n)? cant use A(n) since matlab will read it as an array.
0 件のコメント
回答 (2 件)
Walter Roberson
2012 年 9 月 30 日
1 件のコメント
Jan
2012 年 9 月 30 日
@James: Such questions are asked such frequently, that they are collected in the FAQ. Please read them carefully.
Azzi Abdelmalek
2012 年 9 月 30 日
編集済み: Azzi Abdelmalek
2012 年 9 月 30 日
- You can use A(n) if your data are numbers or char (same class),
example:
A=[10 20 30 40 ];
A(1)
A(2)
...
- use A{n} if your data are both, or same class with different sizes
A={'color','price';'red','100';'green','200'}
3 件のコメント
Walter Roberson
2012 年 9 月 30 日
If it is just output and not variable names, then
fprintf('A%d', n)
Azzi Abdelmalek
2012 年 9 月 30 日
A=[3 5 6;5 3 4;6 7 9] %example
out=[];
for k=1:size(A,1);
out=char(out,[sprintf('A%d ',k) num2str(A(k,:))]);
end
disp(out)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!