passing a list of variables instead of the variables themselves

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by