Hello all!
I am running for loops on timeseries that I have put into an array, and then I calculated the power. I then just want to put it into a matrix — and this has worked and was working until a couple of hours ago.
The first for loop works and the second one does not. The error is:
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 257-by-1.Error in power_and_scatter_plots (line 45) allspectrums_ventricle_young(a,:) = power_ventricle_young;
I've stepped through all the variables to double check that are consistent with their values, and they are! I even took a break and stepped back to see if I could spot an error when i came back — no luck. Has anyone run into this problem, and does anyone have any suggestions?
%% 1) adding paths
addpath(genpath(pwd))%% 2) mr spectogram for each subject
%params
dt = .800;params.tapers=[2 3];params.fs=1/dt;%% 3) defining ts for elderly and youth
%a) youth cortex and ventricle
y_cortex_detrended = {y_d_c_ts_1 y_d_c_ts_2 y_d_c_ts_3 y_d_c_ts_4 y_d_c_ts_5 y_d_c_ts_8 y_d_c_ts_10}y_ventricle_detrended = {y_d_v_ts_1 y_d_v_ts_2 y_d_v_ts_3 y_d_v_ts_4 y_d_v_ts_5 y_d_v_ts_8 y_d_v_ts_10}%b) elderly cortex and ventricle
e_cortex_detrended = {d_c_ts_1 d_c_ts_2 d_c_ts_3 d_c_ts_4 d_c_ts_6 d_c_ts_7 d_c_ts_8 d_c_ts_10}e_ventricle_detrended = {d_v_ts_1 d_v_ts_2 d_v_ts_3 d_v_ts_4 d_v_ts_6 d_v_ts_7 d_v_ts_8 d_v_ts_10}%% 4) power for loops
%youth c - this works!!!!!!
%
for a = 1:length(y_cortex_detrended) name = y_cortex_detrended{a} [power_cortex_young, f] = mtspectrumc(name,params) %detrended cortex young person
allspectrums_cortex_young(a,:) = power_cortex_young; %matrix
end% % %youth v -- this does not!!!!
% for a = 1:length(y_ventricle_detrended) name = y_ventricle_detrended{a} [power_ventricle_young, f] = mtspectrumc(name,params) %detrended cortex young person allspectrums_ventricle_young(a,:) = power_ventricle_young;end
Best Answer