matlab-class Questions

8

Solved

I've come into ownership of a bunch of MATLAB code and have noticed a bunch of "magic numbers" scattered about the code. Typically, I like to make those constants in languages like C, Ruby, PHP, et...
Scraggy asked 20/11, 2009 at 23:24

2

I've created a MATLAB class, something like: classdef myclass properties x_array = []; end methods function increment(obj,value) obj.x_array = [obj.x_array ; value); end end end ...
Shaker asked 7/11, 2008 at 16:27

4

Is there a way to define static member variables in MATLAB classes? This doesn't work: classdef A properties ( Static ) m = 0; end end It suggests to use keyword "Constant" instead of "Stat...
Devisable asked 23/6, 2011 at 6:37

1

Background In previous versions of MATLAB (e.g. R2013b), I had a neat trick where I would attach a listener to an axes handle's YLim property, which would notify me when the axes y-limits were chan...
Cum asked 9/12, 2014 at 20:9

2

Solved

If I declare an object to be a subclass of handle classdef obj < handle my object is now essentially a "pointer" to some memory somewhere. How do I find out how much memory my object is using up...
Twinkle asked 5/3, 2010 at 16:50

2

I come from a Java background. I am having issues with classes in Matlab particularly getters and setters. getting a message saying conflict between handle and value class I'm a little lost with wh...
Folium asked 22/11, 2014 at 12:58

4

Solved

I'm experimenting with MATLAB OOP, as a start I mimicked my C++'s Logger classes and I'm putting all my string helper functions in a String class, thinking it would be great to be able to do things...
Obturate asked 7/11, 2009 at 15:36

2

As an example, suppose I have created an abstract class called Shape and two subclasses called Circle and Rectangle that both implement an (abstract) method called Draw. I would like to be able to ...
Lucilucia asked 11/11, 2013 at 6:47

3

Solved

I have a function for cached evaluation. As one of the arguments, it takes a function handle. Under some circumstances, the function handle is unaccessible, and I don't quite understand why. The ex...
Nita asked 16/10, 2013 at 14:46

1

Solved

I have several matlab classes declared. How could I declare constants which are seen in all classes? For instance: these constants can be physical constants which are used in methods of all classes...
Tomtit asked 14/10, 2013 at 13:13

1

Solved

I'm seeing an issue when I try and reference an object property after having used a dot notation to apply a method. it only occurs when I try to index the initial object classdef myclassexample ...
Speleology asked 7/7, 2013 at 20:14

10

Solved

Are there enumerated types in MATLAB? If not, what are the alternatives?
Fredricfredrick asked 7/9, 2009 at 11:58

2

Solved

If I make the following toy class in MATLAB: classdef testIt properties a b c end methods function obj = testIt obj.a = 1; obj.b = 2; end function obj = set.a(obj,a) obj.a = a; end ...
Kopje asked 13/12, 2012 at 20:3

1

Solved

I've been vectorizing some matlab code I'd previously written, and during this process matlab started crashing due to segmentation faults. I narrowed the problem down to a single type of computatio...
Refusal asked 28/8, 2012 at 2:54

1

Solved

I can't figure out how to do such a simple thing like defining constants using other ones. For instance, a dummy example : classdef DummyClass < handle properties (Constant) NB_SECONDS_IN_MI...
Buckboard asked 26/1, 2012 at 15:5

1

Suppose I have a class myClass < handle. From the Mathworks Help page on clear, Clearing handle graphics handles does not remove the objects themselves, nor does deleting the objects remove ...
Widow asked 29/8, 2011 at 22:17

3

Solved

Suppose I have the following class: classdef myClass < handle properties A = 1 end methods function obj = myClass(val) obj.A = val; end end end Say I instantiate an instance of this ...
Gonfanon asked 16/8, 2011 at 21:59

2

I've got two new-style MATLAB classes - B & C, both concrete subclasses of an abstract parent, A. A is a subclass of hgsetset (handle class). I'd like to put them in an array in MATLAB, and tre...
Solemnity asked 22/9, 2009 at 4:23

1

Solved

I am creating a class in MATLAB and while I have little experience with objects, I am almost positive I should be able to set a class property using a class method. Is this possible in MATLAB? cl...
Williswillison asked 16/3, 2011 at 2:49

4

MATLAB has two ways of organizing classes: @-directories: @ClassName\ ClassName.m Method1.m Method2.m Single files: ClassName.m: classdef ClassName methods % all methods included ...
Gotama asked 26/3, 2010 at 18:4

3

I am trying to create a MATLAB class with a member variable that's being updated as a result of a method invocation, but when I try to change the property within the class it (apperently, from what...
Tamie asked 16/10, 2008 at 15:22
1

© 2022 - 2024 — McMap. All rights reserved.