Error when executing an existing code
1 view (last 30 days)
Show older comments
Hello guys,
I'm a new Matlab user, and I'm having some problems running code copied directly from a reference. There are several errors and observations in the model, which is quite extensive, by the way. Although the problems in the code seem to me to be quite broad, I would like to know how I can correctly check each error indicated? I have attached a .m file containing the code.
The reference from where I copied the code is at the end of the text at: https://digitalcommons.usf.edu/cgi/viewcontent.cgi?article=2440&context=etd
3 Comments
Answers (1)
Jan
on 29 Mar 2022
Error: File: Untitled27.m Line: 1380 Column: 3
Unexpected MATLAB operator.
(referent to: "function ret=arc2(r1,r2,h,phi)")
At this location the code is
arc2.m
function ret=arc2(r1,r2,h,phi)
The actual problem is "arc2.m" . This looks like it should be the name of the m file, not a part of the code. So create an m file called "arc2.m" and insert the following code.
This problem occurs repeatedly, e.g. line 2288:
eucnorm.m (Originally written by E. Marquez (1994), modified by C. O’Brien (2003))
function ret=eucnorm(n,z)
The first line should not be a part of the code!
By the way, this is an ugly implementation of a euklidean norm.
Error: File: Untitled27.m Line: 1651 Column: 1
Unterminated %{ block. Use %} to terminate.
There is a bunch of nested %{ %} commant blocks. This is not allowed. The person, who has created this muddy code is the one, who can provide a celan version. It is impossible to guess, which comment blocks are wanted and which are defined by accident.
The code is useless, as you have found out already. Do not try to solve a real problem with it. The debugging and fixing will take more time than deleting and rewriting the code in a clean way.
0 Comments
See Also
Categories
Find more on Using MATLAB Projects in Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!