필터 지우기
필터 지우기

Hi! Can anybody help me with my code?

조회 수: 1 (최근 30일)
Matty
Matty 2022년 10월 14일
편집: Image Analyst 2022년 10월 14일
mass_AnPoll = 0;
for i = 1:5
mass_AnPoll = mass_AnPoll + mer(1:i);
end
Error Message in Code: "Arrays have incompatible sizes for this operation."

채택된 답변

Image Analyst
Image Analyst 2022년 10월 14일
편집: Image Analyst 2022년 10월 14일
size(mass_AnPoll)
size(mer)
Perhaps you want to append the elements
mass_AnPoll = 0;
for i = 1:5
mass_AnPoll = [mass_AnPoll, mer(1:i)]; % or [mass_AnPoll; mer(1:i)]
end
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

추가 답변 (1개)

KSSV
KSSV 2022년 10월 14일
mass_AnPoll = 0;
for i = 1:5
mass_AnPoll = mass_AnPoll + mer(1,i); % mer(1,i) this should be a single number of you index
end
You can simply also use:
mass_AnPoll = sum(mer(1,1:5))

카테고리

Help CenterFile Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by