Borrar filtros
Borrar filtros

dynamically name function output

2 visualizaciones (últimos 30 días)
fadams18
fadams18 el 15 de Jul. de 2020
Editada: Stephen23 el 15 de Jul. de 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 comentario
Stephen23
Stephen23 el 15 de Jul. de 2020
Editada: Stephen23 el 15 de Jul. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by