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