Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

2 visualizzazioni (ultimi 30 giorni)
ew = [-1 0 0 3]; % [<begin pre> <end pre> <begin post> <end post>]
for abc = 1:size(ew,2)
[~, ix(abc)] = min(abs(tw-ew(abc)));
end
clearvars window table_rat table_sex table_trial table_licklat table_numlicks table_pks table_locs table_drug
row = 1;
for abc = animalnumber
for xyz = 1:data(abc).ntrain
wind = data(abc).trainOn(xyz):data(abc).trainOn(xyz)+ix(4);
if isempty(find(data(abc).locs>wind(1) & data(abc).locs<wind(end)))
else
table_rat(row,1) = {data(abc).animal};
table_sex(row,1) = {data(abc).sex};
table_drug(row,1) = str2num(data(abc).conditions(1));
table_trial(row,1) = xyz;
table_licklat(row,1) = data(abc).licklat(xyz);
table_numlicks(row,1) = data(abc).numolicks(xyz);
table_pks(row,1) = max(data(abc).pks(data(abc).locs>wind(1) & data(abc).locs<wind(end)));
table_locs(row,1) = data(abc).locs(data(abc).pks==table_pks(row,1));
table_pkfreq(row,1) = numel(data(abc).pks(data(abc).locs>wind(1) & data(abc).locs<wind(end)))/(size(wind,2)/fsg1);
row = row + 1;
end
end
end
vars = {'rat','sex','drug','trial','licklat','numlicks','locs','pkmag','pkfreq'};
table_pkmagtrial = table(table_rat,...
table_sex,...
table_drug,...
table_trial,...
table_licklat,...
table_numlicks,...
table_locs,...
table_pks,...
table_pkfreq,...
'VariableNames',vars);
writetable(table_pkmagtrial,'pkmagtrial3s.csv','Delimiter',',')
clearvars table_rat table_drug table_trial table_locs table_pks
  1 Commento
Jan
Jan il 24 Giu 2019
You forgot to ask a question and to post a copy of the complete error msssage. Please format your code properly in addition.
Do not waste the time with clearvars, because it is rarely useful.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by