Acessing object properties is not working

I seem to be to stupid to create a matlab object. Here is my file "data.m":
classdef data
properties
x=0;
end
methods
function this = data(a)
this.x=1;
end
end
end
When running the code I keep getting the message: "No public field x exists for class data." Also tried changing SetAccess and GetAccess of properties to public.
What am I missing?
Best,
Eddy

답변 (1개)

Eddy Ilg
Eddy Ilg 2014년 4월 4일

0 개 추천

Never mind,
I found out that I had old instances of data. When changing the code you need to "clear" the workspace, otherwise changes to the property section do not have effect and you may try to access previously not existing members.
Best,
Eddy

카테고리

도움말 센터File Exchange에서 Class Introspection and Metadata에 대해 자세히 알아보기

질문:

2014년 4월 4일

답변:

2014년 4월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by