some errors when i try to use the code of snake
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hi when i try to use the code of snake some errors appear like
Input argument 'f' is undefined.
Error in ==> C:\MATLAB6p5\toolbox\matlab\datafun\gradient.m On line 42 ==> [msg,f,ndim,loc,cflag] = parse_inputs(f,varargin);
could you help me please ???
0 Kommentare
Antworten (2)
Cedric
am 24 Apr. 2013
Bearbeitet: Cedric
am 24 Apr. 2013
You are calling parse_inputs without passing any argument, whereas it requires one (at least). After this call (where neither f nor varargin are defined), you hit a point in the function (on line 42) where f is used without being defined.
0 Kommentare
narjes
am 25 Apr. 2013
2 Kommentare
Cedric
am 26 Apr. 2013
Bearbeitet: Cedric
am 26 Apr. 2013
Well, let's put it this way: if you have just that to solve and then you are done with MATLAB, we can talk a little further and work on some copy/paste of your code to find out what is not working. However, if you will have to use MATLAB seriously for your research, the best advice that I can give you is to take something like 3 or 4 hours per day during a week or a few days full, and work intensely to raise your MATLAB skills. If you do this, then you'll be able to use MATLAB as a tool and debug most problems by yourself. I we just debug your program now, you'll be stuck again soon.
For learning MATLAB, I would recommend:
in the section called MATLAB, you could start with the Primer, then go over some material in Mathematics (and or Data Analysis), as well as Programming fundamentals. In each one of these PDFs, the most important is to find sections about data manipulation (creating numerical arrays, cell arrays, structs, and indexing them), about conditional statements, about iterative statements, and about scripts and functions. These PDFs contain a lot of examples, so it's not that long finally to go over the relevant material.
About the current error, can you check if this "image" input parameter that you pass to the function GRADIENT is valid? I.e. is it define, what is its class, and what is its size?
Image Analyst
am 26 Apr. 2013
Was that one big long error, or two separate errors? For one, this line looks very bad:
[grady,gradx] = gradient(image);
image is a built in function. I hope you didn't destroy it by using it as the name of one of your variables.
I think those are two separate errors. It's best if you give the complete error, with the complete traceback into all functions - ALL the red text. Don't snip out just part of it because we need to see the big picture. Often the final error will lie inside one of MATLAB's functions but that doesn't mean their function is where the fault lies, it happened more upstream when you passed some function inappropriate value(s).
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!