How do I repeat a function on each and every column of a 241X1236 array?
Afficher commentaires plus anciens
I am able to do it for one column
cwt1 = cwt(All_mean(:,1), 1:64, 'sym8');
Here, All_mean is the 241X1236 array. cwt, 1:64 and 'sym8' is the function.
I have something like this
for
z= 1: size(All_mean, 2)
cwt1 = cwt(All_mean(:,1), 1:64, 'sym8');
cwt(z)=cwt(All_mean(:,z), 1:64, 'sym8');
end
The output I get is a 64X241 array. I need to store every output array with a name like 'cwt1', 'cwt2', 'cwt3'.... 'cwt1236'.
Please can anyone help me? I am very new to matlab.
Réponse acceptée
Plus de réponses (1)
Ameer Hamza
le 18 Mai 2018
Modifié(e) : Ameer Hamza
le 18 Mai 2018
0 votes
Why would you want to do that? Managing values in form of matrices is much easier, efficient and robust as compared to naming your variables like 'cwt1', 'cwt2', ... . cwt1 is same as cwt(:,1), so use the better option. Naming the variables like that is unrecommended: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval. As you mentioned, you are new to MATLAB, this is good chance for you to start following recommended coding practices to make your code efficient and less buggy.
1 commentaire
Dee
le 18 Mai 2018
Catégories
En savoir plus sur Descriptive Statistics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!