Set types of properties in MATLAB classes

https://undocumentedmatlab.com/blog/setting-class-property-types

I got an error when I tried to initialize a property of a class to another MATLAB class. The error read:

Conversion to double from (Class Name) is not possible.

So I looked for a way to specify the type of a property and found the link above. In short, @Type needs to follow the name of a property like

classdef (Class Name)
    properties
        property@Type
    end
end

Or property Type is also possible since MATLAB R2016a.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s