how can i overcome this error ? why i am getting error like this ?

1 回表示 (過去 30 日間)
shankar c
shankar c 2020 年 5 月 7 日
編集済み: Mehmed Saad 2020 年 5 月 7 日
Attempt to execute SCRIPT watershed as a function:
C:\Users\user\Documents\MATLAB\watershed.m
Error in Untitled8 (line 13)
L = watershed(gmag);
m getting error like this what is the solution
  1 件のコメント
KSSV
KSSV 2020 年 5 月 7 日
It lookslike what you have is a scrip and not a function......run the file using F5 or through the run button or type the name of file in the workspace.

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

回答 (1 件)

Mehmed Saad
Mehmed Saad 2020 年 5 月 7 日
編集済み: Mehmed Saad 2020 年 5 月 7 日
watershed is some mfile in your code and not a function. You are trying to execute it as a function which is why it is giving error.
If you want to execute watershed script just simply type
watershed
This will work fine
To convert watershed script to function, add this line at the start of watershed
function L = watershed(gmag)
assuming that it only needs gmag as input and L as output
Now because watershed changes from script to function you can call it by
L = watershed(gmag);

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by