Matlab Call Subroutine Function

This is my notes about how Matlab call subroutine. We could make them all static methods on a utility class. The functions will be globally referenceable by name, but you only need to manage one M-file. Please look at my sample code :

classdef test_toto
    methods (Static)       
        function [a1] = test1_toto
            a1 = 'test1';
        end

        function [a2] = test2_toto
            a2 = 'test2';
        end
    end
end

We can call the sub function in Matlab with command like this :

>> test_toto.test1_toto
ans =
test1

>> test_toto.test2_toto
ans =
test2

The sample code above show how simple call sub function in Matlab.

Source :
http://stackoverflow.com/questions/5973699/is-there-any-way-to-call-a-matlab-subfunction-from-the-outside-the-file

Add a Comment

Your email address will not be published. Required fields are marked *