필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Passing variable sized arguments to a method

조회 수: 1 (최근 30일)
Sepp
Sepp 2017년 10월 23일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello
I'm using the PrintTable method of the matlabtools . In the documentation the following example is given:
t = PrintTable('LaTeX/PDF export demo, %s',datestr(now));
t.HasRowHeader = true;
t.HasHeader = true;
t.addRow('A','B','C');
Let's say I have the header names in a cell array `header = {'A','B','C'}`. Unfortunately a cell array cannot be passed to `addRow`, i.e. `t.addRow(header);` does not work. Unfortunately the size of the header varies in my case, that's why I'm storing it in a cell array.
How can I call the `addRow` method with a variable sized cell array?
  댓글 수: 1
Rik
Rik 2017년 10월 23일
Wouldn't a for-loop work?

답변 (1개)

Jan
Jan 2017년 10월 24일
편집: Jan 2017년 10월 24일
I do not know this toolbox and installing it just to answer this question might be inefficient. Do I understand correctly, that
t.addRow('A','B','C');
works, but you have a cell array as input? Then this creates the comma separated list with a variable size of elements:
header = {'A','B','C'}
t.addRow(header{:});

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by