How to put data from different structures in one matrix?
显示 更早的评论
I'm working with EMG signals (data from 10 subjects for 3 motions) and when I filtered and normalized the data, I saved them in a structure. Example: EMGProcessed.(subjects{i}).(motion{k}).
Now I want to plot the average values of those EMG signals and I if I calculate the averages, I get one value for each subject, but I want to plot the averaged signal for all subjects in one plot. I can't figure out how to extract the data from the structures in a way I can get all the averages of the different subjects in one matrix.
Here's a part of my code:
Names = {'soleus_l' 'tib_ant_l' 'gas_lat_l' 'vas_lat_l' 'rect_fem_l' 'ham_lat_l'};
format = size(Names);
for k = 1:3
MeanResult.(motion{k}) = zeros(1,format(2));
StdResult.(motion{k}) = zeros(1,format(2));
for s =1:1:format(2)
Temp252 = strcmp(Names(1,s),EMG.(subjects{i}).(motion{k}).headers);
IndexSoleus = find(Temp252==1)+1;
MeanSoleus = mean(EMGProcessed.(motion{k})(:,IndexSoleus));
StdSoleus = std(EMGProcessed.(motion{k})(:,IndexSoleus));
MeanResult.(motion{k})(1,s)=MeanSoleus;
StdResult.(motion{k})(1,s)=StdSoleus;
end
end
Obviously I get an the error that matlab can't find 'motion', beacause all my structures are saved as data.subjects.motion, but now I want the average motions for all the subjects and not for each subject.
I hope my explanation is understandable!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Detection, Range and Doppler Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!