Azzera filtri
Azzera filtri

dynamically name function output

2 visualizzazioni (ultimi 30 giorni)
fadams18
fadams18 il 15 Lug 2020
Modificato: Stephen23 il 15 Lug 2020
I would like to to dynamically name fuction output based on some inputs
Like: As my variable para.algo will be changing, is it possible automatically append it to the output SIR?
para.algo='RPIS';
[SIR, ~] = bss_eval_mix(W.', Htheo.');
% I dont want to manually write this,
% I would like it to be done automatically using value of algo
[SIR_RPIS, ~] = bss_eval_mix(W.', Htheo.');
  1 Commento
Stephen23
Stephen23 il 15 Lug 2020
Modificato: Stephen23 il 15 Lug 2020
That approach will force you into writing slow, complex, obfuscated code and makes accessing the data harder. Your code will break for any para.algo that contains characters that are not valid in MATLAB variable names.
Just use simple, efficient indexng to store both the function output and the algorithm name.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by