Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Can I convert a class to a struct?

Subject: Can I convert a class to a struct?

From: Daniel Armyr

Date: 10 Nov, 2008 13:06:01

Message: 1 of 2

Hi.
Now with Matlab supporting classes, alot of these constructs that used to be structs, I have now implemented as classes. Now, once I have made a class, does anyone know of a built-in method to create a struct that has as its fields, all the properties of the class?

What I want is to take a class that may have very dynamic behaviour and freeze it into a structure of static data.

Sincerely
Daniel Armyr

Subject: Can I convert a class to a struct?

From: Doug Schwarz

Date: 10 Nov, 2008 14:42:23

Message: 2 of 2

In article <gf9bjp$h8b$1@fred.mathworks.com>,
 "Daniel Armyr" <firstname@lastname.se> wrote:

> Hi.
> Now with Matlab supporting classes, alot of these constructs that used to be
> structs, I have now implemented as classes. Now, once I have made a class,
> does anyone know of a built-in method to create a struct that has as its
> fields, all the properties of the class?
>
> What I want is to take a class that may have very dynamic behaviour and
> freeze it into a structure of static data.
>
> Sincerely
> Daniel Armyr


s = struct(object);

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us