What do I need to write in f2 (u1, u2) so that I do not have the error :
Undefined function or variable 'ETA'.

回答 (1 件)

Cris LaPierre
Cris LaPierre 2021 年 1 月 14 日

0 投票

What is ETA?
You cannot use a variable you have not defined. Perhaps you think this variable is loaded by data.mat, but apparently not.

7 件のコメント

Image Analyst
Image Analyst 2021 年 1 月 14 日
Or else, you need to pass ETA into f2(). f2 is not going to magically know what ETA is unless you tell it.
yonatan friedman
yonatan friedman 2021 年 1 月 14 日
編集済み: yonatan friedman 2021 年 1 月 14 日
ETA=1, but if i type it in the " targil.m " so it show me the error, but if i type ETA=1 in f2(u1,u2) its not show me the error- ( Undefined function or variable 'ETA'. )
  • ETA could be 2 ,too
Cris LaPierre
Cris LaPierre 2021 年 1 月 14 日
Image Analyst
Image Analyst 2021 年 1 月 14 日
Please attach data.mat and all m-files that are needed to run your code. I'll check back later.
yonatan friedman
yonatan friedman 2021 年 1 月 15 日
編集済み: yonatan friedman 2021 年 1 月 15 日
sorry for the delay,
now i always get the error:
Array indices must be positive integers or logical values.
Cris LaPierre
Cris LaPierre 2021 年 1 月 15 日
The problem is when your for loop counter is 7, the value of d in f4 is a single number. However, in computing ETA, you use d(end-1). Since there is only a single value, end-1=0, which causes the error that you see.
Cris LaPierre
Cris LaPierre 2021 年 1 月 15 日
These types of errors are difficult if not impossible to spot by just inspecting your code. The best way to track down the issue is to learn how to use the debugger.

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

カテゴリ

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

製品

リリース

R2018b

質問済み:

2021 年 1 月 14 日

コメント済み:

2021 年 1 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by