Hi,
I have a cell array (y_fast) of 16x1. Inside of each cell, there is a structure with two fields: Outdata and Outlist. I want to remove field called Outdata from each cell array. The complete name of field I want to remove is in my code y_fast{1,1}.Outdata. I wirte this easy command as example for the first cell array:
y_fast{1,1}=rmfield(y_fast{1,1},Outdata);
but comes the following error:
Undefined function or variable 'Outdata'.
although Outdata is already defined.
Could someone wirte me why??

 採用された回答

madhan ravi
madhan ravi 2019 年 9 月 7 日
編集済み: madhan ravi 2019 年 9 月 7 日

0 投票

cellfun(@(x)rmfield(x,'Outdata'),y_fast,'un',0) % see the quotes around Outdata
doc rmfield
help rmfield

4 件のコメント

Laila Rezai
Laila Rezai 2019 年 9 月 7 日
Thank you for the very good answer. It runs without any error but still does not remove the field Outdata from the structure!!!
madhan ravi
madhan ravi 2019 年 9 月 7 日
When you ask a question , first and foremost attach the datas as .mat file.
Bruno Luong
Bruno Luong 2019 年 9 月 7 日
Assign the result to the variable
y_fast = cellfun(@(x)rmfield(x,'Outdata'),y_fast,'un',0)
Laila Rezai
Laila Rezai 2019 年 9 月 7 日
Thank you very much:). It works now.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Structures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by