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