structure conversion

hi...how can I convert a structure produced from matlab simulink into another datatype(double for example)such that I can use it into another function?

 採用された回答

Jiro Doke
Jiro Doke 2012 年 2 月 25 日

0 投票

Functions can take structures (created from Simulink or elsewhere). It depends on which function you're trying to call. That determines what the input should be. A structure is just a collection of data that may contain other types of data. Type the name of the structure into the Command Window to see what's inside. You can grab the data inside by accessing the fields, e.g.
aStruct.thisField

5 件のコメント

Ahmed Tawfeeq
Ahmed Tawfeeq 2012 年 2 月 26 日
hi...I have managed to get to the field of the structure when I typed:
ahmed.signals where ahmed is the structure name and signals is the field ...signals field contains Values , Dimensions and Label.What I need is to use the Values array (signals data) ...how can I get to Values?
Jiro Doke
Jiro Doke 2012 年 2 月 26 日
You're almost there. Just go one more step:
ahmed.signals.values
Ahmed Tawfeeq
Ahmed Tawfeeq 2012 年 2 月 27 日
Hi...I did that , and thankfully I could get to the values but I experienced another problem:the values is n-dimension...what I found is <30000x1x5 double> array, this array is n-dimension ,I need the vector of this array(I mean <30000x1>).... such that I can transpose it , if you have any info...please tell me.Thanks in advance.
Jiro Doke
Jiro Doke 2012 年 2 月 27 日
Take a look at the command "squeeze".
data = squeeze(ahmed.signals.values);
That will give you 30000x5 double. Now, depending on which column you want, you can type something like data(:, 1)
Ahmed Tawfeeq
Ahmed Tawfeeq 2012 年 3 月 4 日
thanks.....I appreciate your help.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by