フィルターのクリア

Get properties from multilevel objects in matlab in matrix form

1 回表示 (過去 30 日間)
prateek raj gautam
prateek raj gautam 2020 年 1 月 30 日
I want to get values from a multilevel object property in the form of a matrix
here in below example
```
clear all
close all
% dummy initialization of myStruct holding desired property 'x'
for i=1:10
myStruct(i).userdata.error.x=i;% just to illustrate
end
%% working method
Userdata=[myStruct.userdata];
Error=[Userdata.error];
X=[Error.x]%this is required matrix of all x's
```
is there any better alternative to get it in one step
% I want to get values from a multilevel object property in the form of a matrix
% here in below example
% ```
clear all
close all
% dummy initialization of myStruct holding desired property 'x'
for i=1:10
myStruct(i).userdata.error.x=i;% just to illustrate
end
%% working method
Userdata=[myStruct.userdata];
Error=[Userdata.error];
X=[Error.x]%this is required matrix of all x's
% ```
% is there any better alternative to get it in one step

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by