Error in matlab Improper assignment with rectangular assignment with rectangular matrix

hey matlab friends;
I want to find the locatons of matrixpoints which is given by comtime=[4449,1] from a matrix Tt= [5400,1] and i tried using a function
for kk= 1:4449
loc(kk)=find(Tt=comtime(kk,1))
end
bur an error message which says 'Improper assignment with rectangular assignment with rectangular matrix' keeps coming. What can I do with it? thanks for your help.

回答 (1 件)

Tom
Tom 2013 年 6 月 24 日
The number of elements you'll find each time will be different, so you can't put them into a standard array. Try using a cell array instead:
loc = cell(4449,1);
for kk= 1:4449
loc{kk}=find(Tt == comtime(kk,1))
end
You can then access each one using the {} notation, e.g.
loc{1}

8 件のコメント

Ede gerlderlands
Ede gerlderlands 2013 年 6 月 24 日
編集済み: Ede gerlderlands 2013 年 6 月 24 日
yeah.But am getting empty values. Don't know why
Ede gerlderlands
Ede gerlderlands 2013 年 6 月 24 日
I mean, Only the values that starts from 1 and over 9 interval are there , the remaining are empty
Tom
Tom 2013 年 6 月 24 日
do you know what the answer should be? Can you provide some values for comtime and Tt to test with?
Ede gerlderlands
Ede gerlderlands 2013 年 6 月 24 日
編集済み: Ede gerlderlands 2013 年 6 月 24 日
comtime =734869 734869,006944445 734869,013888889 734869,020833333 734869,027777778 734869,034722222 734869,041666667 734869,048611111 734869,055555556 734869,062500000 734869,069444445
Tt=734869 734869,006944445 734869,013888889 734869,020833333 734869,027777778 734869,034722222 734869,041666667 734869,048611111 734869,055555556 734869,062500000 734869,069444445 734869,076388889
Ede gerlderlands
Ede gerlderlands 2013 年 6 月 24 日
All comtime values are members of Tt. so it shouldn't be empty.
Tom
Tom 2013 年 6 月 24 日
And do you know what the answer should be for that data?
Ede gerlderlands
Ede gerlderlands 2013 年 6 月 24 日
It's a long series and I don't know. That's what am looking for.
Jan
Jan 2013 年 6 月 24 日
Please consider rounding errors: The decimal comma seems to show, that the data are not written by Matlab. Comparing values like 734869.006944445 exactly can be tricky, because this could be rounded.

この質問は閉じられています。

タグ

質問済み:

2013 年 6 月 24 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by