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

New to MATLAB?

Thread Subject:
Custom subsref on class

Subject: Custom subsref on class

From: Neil

Date: 14 Nov, 2010 23:37:04

Message: 1 of 1

So I have a class similar to the followig:

classdef SimpleClass < handle
    %SIMPLECLASS Summary of this class goes here
    % Detailed explanation goes here
        function this = SimpleClass(name,val)
            this.Name = name;
            this.Value = val;
        function b = subsref(this,s)
             b = builtin('subsref',this,s);

The subsref method I am using has more implementation but I am using a simple example here because it explain the problem.

I create instances as follows
b = SimpleClass('b',1)
b(2) = SimpleClass('bob',1)
b(3) = SimpleClass('weather',1)

I would like to do the following

 or {b.Name}
However I get the error:
??? Error using ==> subsref
Too many output arguments.

Does anyone have any ideas?

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