Input changes in function
Mostrar comentarios más antiguos
Hi,
I have a strange problem, the input in one of my functions changes to 0 on its own.
example: File of function:
function [output]= test (input,N) input N output = size (input); end
Command: N=20; input=[1:8]; [output]= test (input,N)
Output: input=[] N=0 output = 0 0
How is this possible ? It's only one of the functions that acts this way, and even if i change the name or even make a new one with the same content it acts the same.
1 comentario
bym
el 31 de Mzo. de 2011
Please format your code using the {} button
Respuestas (2)
Matt Fig
el 31 de Mzo. de 2011
Please go back and format your code! Hightlight your pasted code, then click on the "{} Code" button.
Next, clarify what you mean by "function changes to 0 on its own." How can a function change to zero? What are you talking about?
As far as I can tell, this is your function boiled down to essentials:
function [output]= test(input,N)
output = size(input);
Now calling from the command line it seems nothing is amiss:
>> N=20; input=[1:8]; [output]= test(input,N)
output =
1 8
Walter Roberson
el 1 de Abr. de 2011
0 votos
Do not use "input" as a variable name: MATLAB can and will get it confused with the function of the same name.
Categorías
Más información sobre Software Development en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!