Thread Subject: error in static methods block

Subject: error in static methods block

From: meng long

Date: 7 Nov, 2009 09:33:01

Message: 1 of 3

In classdef block, there are a static methods block

     methods (Static)
           oPath = CrHPath(dCdPrdt);
     end

In the static methods block, Matlab always displays the error
     "MCC requires the program to assign a value to output argument 'oPath' ".

My Problem is "How to define the attribute of a static method to avid the error as above?"

Subject: error in static methods block

From: Steven Lord

Date: 8 Nov, 2009 23:45:51

Message: 2 of 3


"meng long" <menglong6518@yeah.net> wrote in message
news:hd3esd$8i9$1@fred.mathworks.com...
> In classdef block, there are a static methods block
>
> methods (Static)
> oPath = CrHPath(dCdPrdt);

This needs to be the declaration of a function CrHPath:

methods (Static)
    function oPath = CrHPath(dCdPrdt)
        % fill in the implementation of CrHPath
    end
end

*snip*

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: error in static methods block

From: meng long

Date: 15 Nov, 2009 14:44:02

Message: 3 of 3

"Steven Lord" <slord@mathworks.com> wrote in message <hd7l5k$m75$1@fred.mathworks.com>...
>
> "meng long" <menglong6518@yeah.net> wrote in message
> news:hd3esd$8i9$1@fred.mathworks.com...
> > In classdef block, there are a static methods block
> >
> > methods (Static)
> > oPath = CrHPath(dCdPrdt);
>
> This needs to be the declaration of a function CrHPath:
>
> methods (Static)
> function oPath = CrHPath(dCdPrdt)
> % fill in the implementation of CrHPath
> end
> end
>
> *snip*
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> Dear Mt. Steven Lord

thanks for your answer.
As mentined in matlab_document, it is allowd that a static method can be defined in "method block" by only attribute, and its body is defined in @ directory.

I must define many static methods. Each static method has coded more than 50 rows.
It is not convient to write code as your mentioned.

menglong

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
sattic method meng long 15 Nov, 2009 09:49:04
oop per isakson 9 Nov, 2009 10:27:44
static meng long 7 Nov, 2009 04:34:04
rssFeed for this Thread

Contact us at files@mathworks.com