Questions tagged [matlab-class]

One of the object oriented programming (OOP) features in MATLAB is the ability to define classes, which can be used to facilitate encapsulation of data and operations. Classes are defined in MATLAB within a `classdef` block, followed by `properties`, `methods`, `events` and `enumeration` subblocks.

103 questions
0
votes
1 answer

Class handle. Matlab

I have 2 similar classes: classdef class1 < handle properties (Access = public) b end properties (Access = private) a end methods (Access = public) function this = class1() this.a = 1; …
hedgehogues
  • 217
  • 3
  • 21
0
votes
1 answer

uicontrol callback function too many input arguments

My goal is to get the user's input from a uicontrol text box, do operations on the input and then display the output to another text box. MATLAB gives me the error: Error using UnitConverter/lbs2kg Too many input arguments. Error…
ih1358
  • 3
  • 2
0
votes
1 answer

matlab oop - how could i handle input of constructor?

I have a handle class, i.e mclass below, which should be constructed inside another function with corresponding input argument. However, i want to check the input argument of the class constructor inside the constructor of wherever in the class…
scmg
  • 1,904
  • 1
  • 15
  • 24
0
votes
0 answers

How to use user-created class in Guide-created GUI

I am creating an application in GUIDE. I've found that using the "handles" structure provided by GUIDE to store data quickly leads to messy/hard to read code. I decided that the best solution is to create my own class to handle data as well as store…
DeeWBee
  • 695
  • 4
  • 13
  • 38
0
votes
1 answer

Matlab classes: inconsistent state and 'PostSet' property listener

I've got a problem of an inconsistent class state in combination with a PostSet Listener. classdef myClass < handle properties (SetObservable,GetAccess = public, SetAccess = public ) propA; propB; end methods …
Jiro
  • 146
  • 3
0
votes
1 answer

MATLAB: error when I try to access property of object

This is the error it returns: You cannot get the 't' property of Planet. Error in Problem4dot10 (line 12) name=mercury.t(mercury); I created getter functions to return properties of the class planet: methods %for getter functions function…
user3273814
  • 198
  • 3
  • 16
0
votes
0 answers

Matlab listeners multiple execution

I have an issue using MATLAB listeners: PreGet and PostGet. My purpose is to be able to execute a set of functions when I am writing and when I am writing a calls property (before and after each read/write operation). This is an example of my…
uhnucross
  • 103
  • 1
  • 8
0
votes
1 answer

using ordinary methods in matlab

I am a little bit rusty on Oop. I have following code. classdef diag2by2 properties a; b; end methods function obj = diag2by2(a, b) obj.a = a; obj.b = b; end function obj =…
Leo04577
  • 13
  • 4
0
votes
2 answers

MATLAB: OOP Calling Functions from Different Class

My goal is to design a re-usable engine programmed in MATLAB using MATLAB OOP. This is my first attempt to do this. My problem that I would like to resolve is the following: I have an abstract class cPayoffBase that defines the interface for an…
0
votes
0 answers

How to add a class in the MATLAB path

I have 2 classes in folder : C:\controller\functions\VerifyModel.m C:\OGVD\prod\KMLP\controller\controllerStatus.m VerifyModel.m classdef verifyModel < matlab.unittest.TestCase methods(access=public) function... …
lola
  • 5,649
  • 11
  • 49
  • 61
0
votes
1 answer

Are matlab 2012b's classes backwards-compatible?

I just discovered that Matlab has implemented classes, but I can't find any information as to how long this feature has existed. Does anybody know if the classes defined by classdef are backwards compatible with older versions of matlab? If so, how…
Louis Thibault
  • 20,240
  • 25
  • 83
  • 152
0
votes
1 answer

Assignment to a superclass

How does one go about assigning to an object's superclass? Example: classdef foo < bar ... methods function this = barSet(this,b) % Here I want to arrange that bar(this) == b end end end How (or can) I implement barSet?
lsfinn
  • 446
  • 2
  • 4
-1
votes
1 answer

How to get A Dependent Property depending on properties of objects of different class in Matlab

See the code below: Ex_ObjA.m classdef Ex_ObjA properties a end methods function Obj=Ex_ObjA(t) Obj.a = t; end end end Ex_ObjBC.m classdef Ex_ObjBC properties b end …
1 2 3 4 5 6
7