photo

Rani Feldman


WDC

Attivo dal 2018

Followers: 0   Following: 0

Messaggio

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

Statistica

MATLAB Answers

1 Domanda
0 Risposte

RANK
114.645
of 301.454

REPUTAZIONE
0

CONTRIBUTI
1 Domanda
0 Risposte

ACCETTAZIONE DELLE RISPOSTE
0.0%

VOTI RICEVUTI
0

RANK
 of 21.287

REPUTAZIONE
N/A

VALUTAZIONE MEDIA
0.00

CONTRIBUTI
0 File

DOWNLOAD
0

ALL TIME DOWNLOAD
0

RANK

of 174.632

CONTRIBUTI
0 Problemi
0 Soluzioni

PUNTEGGIO
0

NUMERO DI BADGE
0

CONTRIBUTI
0 Post

CONTRIBUTI
0 Pubblico Canali

VALUTAZIONE MEDIA

CONTRIBUTI
0 Punti principali

NUMERO MEDIO DI LIKE

Feeds

Visto da

Domanda


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...

circa 8 anni fa | 0 risposte | 0

0

risposte