Unable to perform assignment because the left and right sides have a different number of elements -- variables do have same number

1 visualización (últimos 30 días)
I am trying to make a for loop loop through data, detrend it, then output it is a variable so that i can plot them. For some reason i am getting the error of 'Unable to perform assignment because the left and right sides have a different number of elements' when the variables do have same dimensions. Does anyone have any ideas?
subj = {'HCA1','HCA2','HCA3'}; %HCPsubj list
%% loading paths and such
D = '/Users/ll/Documents/data_analysis/HCP/seventy/';
%% indexing and putting all seventy graphs into one
a = zeros(478,1); %pre-allocate a vector to store results
for k = 1:length(subj)
name = subj{k};
c = load(fullfile(D,name,'ts','lcortex_run01regPA.txt'));
v = load(fullfile(D,name,'ts','ventricle_run01regPA.txt'));
%s = load(fullfile(D,name,'ts','spinal_run01regPA.txt'));
% c_ts = l
% v_ts = v
%
%% detrend ventricle and cortex
d_v_ts = detrend(v) %detrended time series of ventricle
d_c_ts = detrend(c) %detrended time series of cortex
for n=1:numel(a)
ventricle_data = d_v_ts; %do something with that data
a(n)=ventricle_data; %store it in the vector
end
end
  1 comentario
Walter Roberson
Walter Roberson el 30 de Dic. de 2019
You load() a file. The result in v is almost certainly a vector or 2D array. detrend() applied to that would be the same size. You then loop 478 times, each time copying the entire vector or array into ventricle_data, and trying to store that entire vector or array into the single numeric location a(n) .

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Electrophysiology en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by