Error using - Matrix dimensions must agree. Error in mmmmmmmtest1m (line 326) a2=aa-a1;

1 Ansicht (letzte 30 Tage)
Error using -
Matrix dimensions must agree.
Error in mmmmmmmtest1m1m (line 326)
a2=aa-a1;
i am surprised why my a2 not calculating my aa value is ok and a1 but the aa and a1 matrices are not equal when i minus them it gave above error ,i spend 10 days on it but this issue is not solving
---------------------------------
Code Hints:-
u(hour)=hour;
Clothesdrye(hour)=power_pattern(hour,1);
a1=find(Clothesdrye);
------------------------------------------------
stereo=[1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1];
Fan=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1];
aa=find(stereo);
bb=find(Fan);
-------------------------------------------
Index
a2=aa-a1;
b2=bb-b1;
% len = min([numel(aa) numel(a1)]);-----1
% a1 = aa(1:len) - a1(1:len);-----2
%a1=linspace(0,14,14);%# 14 values spanning the range 0 to 14------3
%a1=[1 8 9 10 11 12 13 14 15 16 17 22 23 24];----4
i have also tried from 1 to 4 but in vain
i am pasting the bit pattern of variables may be helpful for commenters/guiders below.
Error using -
Matrix dimensions must agree.
Error in WDO_SG_Code_PL_test1m (line 326)
a2=aa-a1;
>> u
u =
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
>> power_pattern
power_pattern =
0 0 0 0 0 0 0 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 1 1 1 0
>> Clothesdrye
Clothesdrye =
0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> a1
a1 =
2 3 4
>> aa
aa =
1 8 9 10 11 12 13 14 15 16 17 22 23 24
>> a1
a1 =
2 3 4
>> a2
Undefined function or variable 'a2'.
>> Dish_washe
Dish_washe =
0 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> b2
Undefined function or variable 'b2'.
>> bb
bb =
9 10 11 12 13 14 15 16 17 19 23 24
>> b1
b1 =
2 3 4 5 6 7 8 10

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 5 Dez. 2015
Bearbeitet: Walter Roberson am 5 Dez. 2015
Your aa has is a 14 element row vector. Your a1 is a 3 element row vector. What result are you expecting when you subtract them?
Hint: bsxfun()

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by