photo

Rani Feldman


WDC

Con actividad desde 2018

Followers: 0   Following: 0

Mensaje

I am using level 2 Matlab S-function. Also I have a class that I define that calculates something.
I want to have 2 instances of the same level 2 Matlab S-Function using the same class.
But each instance of the S-Function should have it's different instance of the class.
So in:
function InitializeConditions(block)
test = myClass(5);
%end InitializeConditions
and then in:
function Outputs(block)
test.increment();
block.OutputPort(1).Data = test.a;
%end Outputs

I need each class to have it's own instance.
- Using global is not good because I will have only 1 instance of the class.
- I cannot use DWork to store the class.

classdef myClass < handle
properties
a;
end
methods
function obj = myClass(a)
obj.a = a;
end
function increment(obj)
obj.a = obj.a + 100;
end
end
end

Estadística

MATLAB Answers

1 Pregunta
0 Respuestas

CLASIFICACIÓN
114.645
of 301.454

REPUTACIÓN
0

CONTRIBUCIONES
1 Pregunta
0 Respuestas

ACEPTACIÓN DE RESPUESTAS
0.0%

VOTOS RECIBIDOS
0

CLASIFICACIÓN
 of 21.287

REPUTACIÓN
N/A

EVALUACIÓN MEDIA
0.00

CONTRIBUCIONES
0 Archivos

DESCARGAS
0

ALL TIME DESCARGAS
0

CLASIFICACIÓN

of 174.632

CONTRIBUCIONES
0 Problemas
0 Soluciones

PUNTUACIÓN
0

NÚMERO DE INSIGNIAS
0

CONTRIBUCIONES
0 Publicaciones

CONTRIBUCIONES
0 Público Canales

EVALUACIÓN MEDIA

CONTRIBUCIONES
0 Temas destacados

MEDIA DE ME GUSTA

Feeds

Ver por

Pregunta


Using classes in level 2 Matlab S-function
I am using level 2 Matlab S-function. Also I have a class that I define that calculates something. I want to have 2 instances o...

alrededor de 8 años hace | 0 respuestas | 0

0

respuestas