Creating a dataset array
Afficher commentaires plus anciens
I know this is so basic but I just can't get this to work. I have a dataset 13*30 representing power values of different frequencies in the signal. There are 30 variables, and 13 observations for each. (the Hz are 1/2 Hz bins).
I have tried the following code that I adapted from the help menu.
cow={'one';'two';'three';'four';'five';'six';'seven';'eight';'nine';'ten';'eleven';'twelve';'thirteen'} ;
NumObs=size(PxxD6L72,1);
NameObs=strcat({'cow'},num2str((1:NumObs),'%-d'));
Hz=Hz';
frequencyDL=dataset({nominal(cow),'cow'},{PxxD6L72, 'half','one','one onehalf','two','two and half','three','f','t','r','y','e','v','w','d','e','e','c','p','z','x','q','a','s','v','g','r'',y','p','u','h'},'ObsNames','NameObs');
I also have tried labeling the variables in the columns 1,1.5...15. The rows of PxxD6L7 represent the 13 different subjects(cows).
I get this error message
rror using ==> dataset.dataset>dataset.dataset at 257 Must have one variable name for each column when creating multiple variables from an array.
I don't understand because there are 30 (arbitrarily labeled hz bins- I didn't want to spend time making real labels until I got the code working). I count 30 titles so I don't understand why it says I don't have the right number of labels.
I really need to do either PCA or NMF and it would be so much easier to work with the output if I had labels.
Please help! Thanks Kim
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Managing Data 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!