local function of a class :: Revoke/Call problem

1 回表示 (過去 30 日間)
Sadid
Sadid 2012 年 12 月 22 日
Hi, Happy Christmas!
I have a problem in concept of local function of a class. Considering this conditions:
I've a class called STWS which I've put it in the @STWS folder. along the class defenition I've put f.m file (very simple ordinary matlabl function). my current directory is the parrent directory of @STWS and I'm running a main.m script to use the class (pretty standard, isn't?). I want to use f.m inside my constructore method but I encounter this problem:
A) when I write the f in this way obj = f(obj,varargin) and use it insdie the constructor.... No problem
B) when I write the f in this way y = f(obj,varargin) and use it in this way: y = f(obj,x) It works but pretty wiered to me! I'm newbie and I cant recognize the mechanism
C) [my first desired way] I write the f as y=f(x,varargin). and I wanted to use it in the constructor in ordinary way (without passing the thisObject), I get the undefined function error.
methods function obj = STWS(x,varargin) ..... obj.w = f(x,varargin) end
other methods
end
why the C doesn't work (I even examine putting f inside methods block of main class but that was the same. Does any local function should get and pass the thisObject?!!!!

採用された回答

Sadid
Sadid 2012 年 12 月 22 日
Since the method: f is not static, so the C is impossible....

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by