matlab code erro massage where ~ used

4 ビュー (過去 30 日間)
Maria hassan
Maria hassan 2016 年 12 月 6 日
コメント済み: Image Analyst 2016 年 12 月 7 日
Hi,
I am running matlab code but I getting error massages. The first massage I get is '?? Error: File: matlablabtest.m Line: 62 Column: 11 Expression or statement is incorrect--possibly unbalanced (, {, or [.
Also getting same error in line: 67,69,74,98,169,225,230,232,237,298 where (~)is used. I have attached the data is that help in checking it. I have attached the m file and data in case that help to get the answer.
Regards Sarah

採用された回答

Jan
Jan 2016 年 12 月 6 日
The ~ is used to omit output arguments. It was introduced in R2009b, as far as I remember. If you use an earlier version, replace it e.g. by "dummy".
  3 件のコメント
Jan
Jan 2016 年 12 月 7 日
Start with removing the brute clearing header. "clear all" is a waste of time. Write one command per line only.
The error message is clear: There is a problem in "[y1lag(lagno(i)+2:T,:) dylag(lagno(i)+2:T,:)]", because an index is used, which is larger than the array dimensions. Due to the very lean comments a reader cannot guess the intention of the code and therefore it is nearly impossible to debug.
Please avoid pushings like "asap". It is not friendly.
Image Analyst
Image Analyst 2016 年 12 月 7 日
The basic common sense debugging technique people use is to count the number of left parentheses and make sure it's equal to the number of right parentheses. Do the same for brackets and braces.
If the counts all match up, then look above for problems in the lines of code above. Perhaps a line was not finished and it's thinking the line you're looking at is really a continuation of one or more prior lines.

サインインしてコメントする。

その他の回答 (1 件)

John D'Errico
John D'Errico 2016 年 12 月 6 日
The problem is you took some code for a newer MATLAB release than you have. So the answer is to get a more recent version of MATLAB, that can handle the code you are running. I'd suggest the current release.
Or, you can modify the code you have, to not have that problem. But it appears as if you don't know much about the language, so that is not really an option.

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by