フィルターのクリア

Find with condition in loop can't create cell array

1 回表示 (過去 30 日間)
Manolis Michailidis
Manolis Michailidis 2015 年 7 月 19 日
コメント済み: Star Strider 2015 年 7 月 19 日
Hello, i have to crate a new vector that will have the different number of peaks in each row for each pulse. So i have this graph where red squares are the minimal and the blue are the peaks for each pulse as you can see. These vectors are pks=[4432 4434 4452 4413 4402 4406 4395 4397 4347 4408 2486 1761 1771 1788 3953], the peaks , lo=[175 203 262 454 553 773 852 1054 1167 1369 1560 1738 1800 1860 2023], the locations of the peaks, also vect=[67 353 646 951 1265 1540], the locations of the minima. Hence i will need to use the find funtion and them store my results to cell, as the number of peaks may differ as you can see from the photo. I did all the above but i get error saying that "Cell contents assignment to a non-cell array object" , here is my code maybe i am missing something but i can't really understand what i am doing wrong , any help really appreciated ,thanks in advance.
for k=1:size(vect,2)
az{k}=find( lo>vect(k) & lo<vect(k+1) );
end

採用された回答

Star Strider
Star Strider 2015 年 7 月 19 日
You must have assigned ‘az’ to something else (other than a cell array) earlier in your code. It is probably easiest to simply rename ‘az’ in the loop, for instance:
for k=1:size(vect,2)
azc{k}=find( lo>vect(k) & lo<vect(k+1) );
end
  3 件のコメント
Manolis Michailidis
Manolis Michailidis 2015 年 7 月 19 日
ok it works now, i have so many variables in my script that i got lost a bit , thank you
Star Strider
Star Strider 2015 年 7 月 19 日
My pleasure.
You can run this from the Command Line or in your script to display all the current variables in your Workspace and their classes:
list_variables = whos;
variable_names_and_classes = {list_variables.name; list_variables.class}'
Be sure to choose some names you wouldn’t otherwise use in your code to assign the result of the whos call and the cell array, so you don’t inadvertently overwrite them. Note that you can also ask for other information about them. Remove the semicolon (;) after the whos call to see all the options.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by