How do you define this function?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have at the top of the script function
[v, v_hat, tau] = VMD_2D(signal, beta, omega, K, DC, init, tol)
for example. When I ran the code for the first time Matlab said signal wasn't defined. Here is what the signal is where it is located in the code
% Construct f and f_hat
f_hat = fftshift(fft2(signal));
% Resolution of image
[Hy,Hx] = size(signal);
When I run the code it says that signal is undefined. Just signal not any of the other inputs. but it says my signal is not defined so I tried to define it by loading an image but it still said it was undefined. Am I missing something? Here is what the signal input's definition is "the space domain signal (2D)." So i guess my question is how do I define the signal? What did I do wrong?
Thanks
0 comentarios
Respuestas (1)
Walter Roberson
el 26 de Jun. de 2015
When you have not passed enough input arguments to a function, the error does not get complained about until you try to access an argument that was not passed in. If it so happened that signal was the missing argument that was accessed first then it would be the one complained about first.
How are you starting the routine? When a function takes parameters you pretty much must start it from the command line (or from a line of code); in particular if you try to start it from the menu or from pressing F5 then the routine will be executed without any arguments being passed in.
You say that you read in an image file but you do not say that you passed the image file in to the routine.
To check: are you aware that when you call a routine, that MATLAB does not look at the dummy parameter names of the routine (e.g, signal or beta) and look in the calling routine (or the base workspace) to try to find variables with the same name and use those values. Whatever value you want the routine to receive must be passed in specifically. The called routine does not have access to variables in the calling routine, not unless the called routine uses evalin() or the variable is a shared variable (and is not a parameter name.)
0 comentarios
Ver también
Categorías
Más información sobre Measurements and Spatial Audio en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!