Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Error: Subscripted Assignment Dimensions Mismatch

조회 수: 6 (최근 30일)
Kira Bruce
Kira Bruce 2019년 11월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
Below I have a code that is intended to take a randomized number matrix of decimals (1 by 400) along with varibles mewfat and mewfib (both are 1 by 400). Over a for loop, I want these values to create a new variable called mewelement and to store the values produced within a new matrix.
Thank you for your help in advance.
x = min+rand(1,400)*(max-min);
[E,mewfib]=Read_Att2([drive_name,'/PHYS4115Tables/att/PMHFIB_ORIGINAL.ATT']);
[k,mewfat]=Read_Att2([drive_name,'/PHYS4115Tables/att/PMHFAT_original.att']);
for f = 1:1:100
a = a + 1;
mewelement(f,a) = (x.*mewfib) + ((1-x).*mewfat);
end
  댓글 수: 3
Kira Bruce
Kira Bruce 2019년 11월 19일
apologises. in my function, max and min are redefined to be variables that are inputed into the function.
how would I go about converting the scalar to a row vector?
Guillaume
Guillaume 2019년 11월 19일
You'd better rename these variables. Using max, min, sum, etc. as variables is asking for trouble. You won't be able to use these functions and you're going to confuse anybody reading your code.
You can't convert scalars to row vectors. Your code is trying to stuff a bunch a numbers (a vector) into a slot with room for just one number mewelement(f,a), this is simply not possible.
Unfortunately, since there's no comment explaining what the code is meant to be doing, we can't tell you how to fix it.
What size are you hoping mewelement to be at the end of the loop?

답변 (0개)

이 질문은 마감되었습니다.

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by