Invalid default value for property ... Why?

조회 수: 6 (최근 30일)
Laurent Davenne
Laurent Davenne 2017년 12월 6일
답변: Laurent Davenne 2017년 12월 6일
Hi,
I am having an error for which I identified the cause, but not the reason. Here is a simplification of my code, just to give an example.
properties(Constant=true)
A=1;
B=2;
C=A+B;
end
For this Code I get this error: Invalid default value for property 'C' in class 'suspension': Undefined function or variable 'A'.
If I drop those 3 lines in Command Window, of course it works... If I remove the 3rd line, then methods can access A and B.
So why? Does not matlab read properties line by line?
In fact in my code I have 15 arrays (copied from Excel) which I then concatenate into a matrix. It is more convenient for me to write it this way. But when a method call the Matrix, it says the 1 array of the matrix is not defined...
  댓글 수: 1
Jan
Jan 2017년 12월 6일
"it says the 1 array of the matrix is not defined..." Please post the complete error message instead of a rough rephrasing.

댓글을 달려면 로그인하십시오.

채택된 답변

Laurent Davenne
Laurent Davenne 2017년 12월 6일
I think I just found the answer here: post
I should use syntax class.propName

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by