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

조회 수: 1 (최근 30일)
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
Jan
Jan 2019년 6월 24일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by