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

5 Ansichten (letzte 30 Tage)
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;

Antworten (1)

Image Analyst
Image Analyst am 15 Jan. 2022
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.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by