passing a list of variables instead of the variables themselves

4 ビュー (過去 30 日間)
Cristian Berceanu
Cristian Berceanu 2025 年 9 月 2 日
コメント済み: Cristian Berceanu 2025 年 9 月 2 日
Hello all,
I currently call the splitapply function as follows:
output = splitapply(@(DataFilename, Temperature, R504, CPW, Signal) {table(DataFilename, Temperature, R504, CPW, Signal)}, T1, G)
I also have the following variable:
D = {'DataFilename' 'Temperature' 'R504' 'CPW' 'Signal'}
I would like to call the same splitapply function, using the D variable instead of explicitly indicting the individual DataFilename, Temperature, R504, CPW, Signal names.
Something like this (which, unfortunatelly does not work):
output = splitapply(@(D{:}) {table(D{:})}, T1, G)
How could it be done correctly?
Regards,
Cristian

採用された回答

Stephen23
Stephen23 2025 年 9 月 2 日
編集済み: Stephen23 2025 年 9 月 2 日
Something like this:
D = {'DataFilename','Temperature','R504','CPW','Signal'};
F = @(varargin) {table(varargin{:}, VariableNames=D)};
output = splitapply(F, T1, G)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultirate Signal Processing についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by