Remove field from structure nested in a cell array
6 次查看(过去 30 天)
显示 更早的评论
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??
0 个评论
采纳的回答
madhan ravi
2019-9-7
编辑:madhan ravi
2019-9-7
cellfun(@(x)rmfield(x,'Outdata'),y_fast,'un',0) % see the quotes around Outdata
doc rmfield
help rmfield
4 个评论
Bruno Luong
2019-9-7
Assign the result to the variable
y_fast = cellfun(@(x)rmfield(x,'Outdata'),y_fast,'un',0)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!