Create row with text from loop for a table

2 ビュー (過去 30 日間)
Isai Fernandez
Isai Fernandez 2020 年 5 月 19 日
編集済み: Isai Fernandez 2020 年 5 月 19 日
I want to create a table with a row like this:
[Bar No.1; Bar No.2 ... Bar No.n]
I tried it with:
%N = 4x6;
capa = zeros(size(N,1),1);
i=1;
while i<= size(N,1)
capa(i) = sprintf('Capa #%d',i);
i=i+1;
end
I tried also with fprintf, but it doesn't work.
My table has other information which I want to add this column as first:

採用された回答

Stijn Haenen
Stijn Haenen 2020 年 5 月 19 日
you can create table headers with:
a=table();
for i=1:10;
a.(sprintf('bar %g',i))=i;
end
  3 件のコメント
Stijn Haenen
Stijn Haenen 2020 年 5 月 19 日
N=4;
a=table();
for i=1:10;
a.(sprintf('bar %g',i))=zeros(N,1);
end
Isai Fernandez
Isai Fernandez 2020 年 5 月 19 日
編集済み: Isai Fernandez 2020 年 5 月 19 日
How about adding columns with loops? Can you help me?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by