structure conversion

1 vue (au cours des 30 derniers jours)
Ahmed Tawfeeq
Ahmed Tawfeeq le 25 Fév 2012
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?

Réponse acceptée

Jiro Doke
Jiro Doke le 25 Fév 2012
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 commentaires
Jiro Doke
Jiro Doke le 27 Fév 2012
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 le 4 Mar 2012
thanks.....I appreciate your help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by