syntax error in the matlab code in image processing

1 回表示 (過去 30 日間)
Agam
Agam 2014 年 12 月 31 日
回答済み: David Young 2014 年 12 月 31 日
Hi
Can anyone find the syntax error in the line:
>>function sketchrec('../TestCircuit/circuit1.jpg')
Error: File: sketchrec.m Line: 1 Column: 20 Unexpected MATLAB expression.
Parse error at '(' Invalid syntax at STRING

回答 (1 件)

David Young
David Young 2014 年 12 月 31 日
A line starting with
function
is the first line of a function definition. That means it must go in an m-file - usually it is the first line in the file. You can't define a function with this syntax on the command-line.
In a function definition, the thing in parentheses () must be the name of a variable (or more generally a comma-separated list of variable names). It can't be a string. When you call a function, you can give a string as an argument - but when calling a function you don't use the function keyword.
See the documentation for function.

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by