Error in using eval statement
Afficher commentaires plus anciens
Why it shows an incomplete statement ?
I'm trying to write this statement using eval as follows : Energy_H_A1S1 = rms (H_A1S1); but in eval it shows error ?
Thanks in advance.
eval(['Energy_H_A',num2str(1),'S',num2str(1),' = rms(H_A',num2str(1),'S',num2str(1);]);
2 commentaires
"I'm trying to write this statement using eval as follows : Energy_H_A1S1 = ..."
And that is the start of your problems.
Forcing meta-data into variable names makes acessing your data complex, slow, inefficient, and buggy... as your question demonstrates. Meta-data is data. Data should be stored in variables, not in variable names.
Your poor data design forces you into writing bad code, which could be easily avoided by storing the meta-data correctly.
Ramesh Bala
le 10 Jan 2022
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 10 Jan 2022
0 votes
Asking how to use eval without problems is like asking how to use a chainsaw without its chain guard. It would be irresponsible for us to answer in any way other than "Don't do that!"
1 commentaire
Ramesh Bala
le 10 Jan 2022
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!