photo

Rani Feldman


WDC

2018 年からアクティブ

Followers: 0   Following: 0

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

統計

MATLAB Answers

1 質問
0 回答

ランク
258,604
of 301,432

評判
0

コントリビューション
1 質問
0 回答

回答採用率
0.0%

獲得投票数
0

ランク
 of 21,280

評判
N/A

平均評価
0.00

コントリビューション
0 ファイル

ダウンロード
0

ALL TIME ダウンロード
0

ランク

of 174,555

コントリビューション
0 問題
0 解答

スコア
0

バッジ数
0

コントリビューション
0 投稿

コントリビューション
0 パブリック チャネル

平均評価

コントリビューション
0 ハイライト

平均いいねの数

Feeds

表示方法

質問


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

約8年 前 | 0 件の回答 | 0

0

回答