Unable to perform assignment because the left and right sides have a different number of elements.

5 次查看(过去 30 天)
load C:\Users\Ranna\Downloads\2017-05-12_batchdata_updated_struct_errorcorrect.mat
batch1 = batch;
numBat1 = size(batch1,2);
load C:\Users\Ranna\Downloads\2017-05-12_batchdata_updated_struct_errorcorrect.mat
%Some batteries continued from the first run into the second. We append
%those to the first batch before continuing.
add_len = [661, 980, 1059, 207, 481];
summary_var_list = {'cycle','QDischarge','QCharge','IR','Tmax','Tavg',...
'Tmin','chargetime'};
batch2_idx = [8:10,16:17];
for i=1:5
batch1(i).cycles(end+1:end+add_len(i)+1) = batch(batch2_idx(i)).cycles;

回答(1 个)

Image Analyst
Image Analyst 2022-1-15
What is
size(batch(batch2_idx(i)).cycles)
and what is the value of add_len(i)? Evidently they're not the same value so you're trying to stuff either more or fewer elements into a stretch of an array that is defined to be add_len(i) long.

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by