Not sure why I keep getting this error message?

I keep getting this error message, can you help please?

1 件のコメント

Torsten
Torsten 2022 年 10 月 15 日
編集済み: Torsten 2022 年 10 月 15 日
If you open a vector ( [ ), you also have to close it ( ] ):
x = [1 2;...
3 4];

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

回答 (1 件)

John D'Errico
John D'Errico 2022 年 10 月 15 日
編集済み: John D'Errico 2022 年 10 月 15 日

0 投票

Parens need to be balanced. This is true in pretty much any language I can think of, but I am sure there are exceptions. Square brackets, curly braces, etc. No matter what, if you have an [ in there, then you will need a matching ] at the end. So if you write this:
x = [1 2;
2 3;
3 4;
4 5;
This statement is incomplete.

Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON
so without any closure, then expect an error, just as I got. Sometimes you may not get the same identical error message, because in a slightly different context, MATLAB will express its confusion in a different way.
My guess is, in your case, when you failed to put in the closing bracket, then you have another immediate assignment before it sees the closing bracket, MATLAB is generating a different error message from what we see above. It still applies. If you don't balance things out, MATLAB gets upset at you.
When you open a door, you need to close it too.

カテゴリ

ヘルプ センター および File ExchangeFile Operations についてさらに検索

タグ

質問済み:

2022 年 10 月 15 日

編集済み:

2022 年 10 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by