Help adding external functions
Show older comments
Whenever I try to add an external function to my script (written as "external functions: X, Y, Z"), my script keeps syaing that these functions are unrecognized, despite the scripts working on their own even when plugged directly into the main script. If anyone knows how to get these external scripts to run, I would appreciate it
4 Comments
Voss
on 10 Dec 2021
Can you please post the complete text of the error/warning message(s) you get?
Walter Roberson
on 10 Dec 2021
At the moment I do not recall anywhere that uses the syntax "external functions: " followed by a list ?
Could you clarify what it is you are doing, perhaps posting a link to the documentation for that aspect ?
Anthony Koning
on 11 Dec 2021
Walter Roberson
on 11 Dec 2021
Lines beginning with % are just comments. That bit about External Function is there as documentation.
function statements cannot be executed at the command line.
If you have an old enough version of MATLAB, then functions cannot occur inside of "script" files either. Files that are .m files that do not start with the word function or classdef are considered "script" files.
Accepted Answer
More Answers (1)
Chunru
on 11 Dec 2021
0 votes
MATLAB has no external function like c and other languages. It relies on "path" to figure out the external functions. You can still put a comments for external functions to indicate that the current function relies on some other functions.
MATLAB also has more advanced features for managing the data and functions for a project. Search "Projects" in dcouments for more info. If you want to put your software into a better management, refere to class and packages.
Categories
Find more on Entering Commands in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!