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일

0 개 추천

you can create table headers with:
a=table();
for i=1:10;
a.(sprintf('bar %g',i))=i;
end

댓글 수: 3

Thank you. I get this message: «To assign to or create a variable in a table, the number of rows must match the height of the table.»
I check the size of the matrix which I work and nothing.
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개)

카테고리

도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 5월 19일

편집:

2020년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by