create a minimum spanning kruskal

1 回表示 (過去 30 日間)
Boonanan Lechayakittikorn
Boonanan Lechayakittikorn 2015 年 10 月 16 日
回答済み: Walter Roberson 2015 年 10 月 16 日
i met error on my project for run code in matlab. i can't be modified correct. i hope someone help me plsssss thank you
my code in file

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 16 日
The first line of your code is an assignment to a variable, rather than a 'function' or 'classdef'. In MATLAB terms, your code is a "script". In MATLAB, scripts cannot define functions.
In MATLAB, functions may only be defined in function files (files which start with "function" or in classdef files (files which start with "classdef").
You have two choices: You can make your first bit of code a function, or you can move the functions out in to their own .m files.
I also note that at the end after you have your function definitions, you have additional code that is not part of any function. I can tell it is not part of any function because you used the newer (better) syntax of having an "end" matching each "function", and so we can see that the code is after the end of the previous function. It is not possible to have such code in a function (or classdef) file.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by