フィルターのクリア

Unexpected matlab expression error

1 回表示 (過去 30 日間)
SNEHA P S
SNEHA P S 2017 年 3 月 22 日
コメント済み: Steven Lord 2017 年 3 月 22 日
function runSaliency('AloeR_SLIC.jpg')
declareGlobal;
% initialize the Image structure if necessary
if (isa('AloeR_SLIC.jpg','struct'))
img = 'AloeR_SLIC.jpg';
else
In the above code i get an error of unexpected matlab expression at line "function runSaliency('AloeR_SLIC.jpg')". The error is shown at the place where imagename is given. How should i solve this?

回答 (1 件)

James Tursa
James Tursa 2017 年 3 月 22 日
編集済み: James Tursa 2017 年 3 月 22 日
For function definitions, you need to have variable names for the input argument list, not explicit values. E.g., this line
function runSaliency('AloeR_SLIC.jpg')
should look something like this instead
function runSaliency(image_file_name)
where image_file_name is the name of the input variable to the function.
Then downstream in your code, this stuff
if (isa('AloeR_SLIC.jpg','struct'))
img = 'AloeR_SLIC.jpg';
should look something like this instead
if (isa(image_file_name,'struct'))
img = 'AloeR_SLIC.jpg';
  1 件のコメント
Steven Lord
Steven Lord 2017 年 3 月 22 日
To supplement James's explanation, you specify the specific file name you want to process when you call runSaliency, not when you define runSaliency.
>> runSaliency('AloeR_SLIC.jpg')

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

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by