MATLAB Answers

can't invoke static methods in Matlab

1 ビュー (過去 30 日間)
wei du
wei du 2016 年 5 月 20 日
コメント済み: per isakson 2016 年 6 月 11 日
This is a simple .m file. Saved to "temp.m".
In Matlab 7.12.0 (R2011a), I can just call temp.t0() or temp.t1(), it will print the expected results. But in Matlab It shows this error:
>> temp.t0()
??? The function, script, or class temp
cannot be indexed using {} or . indexing.
Is it because Matlab version is low, and it doesn't support to invoke static methods?
Below is the source code of temp.m
classdef temp
methods (Static)
function [] = t0()
fprintf('function t0\n');
function [] = t1()
fprintf('function t1\n');
  1 件のコメント
per isakson
per isakson 2016 年 6 月 11 日
AFAIK: The support for classdef first appeared in R2008a


回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by