Input a number in a function, what is the format of that number in the function?
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I have done a function that accepts 1 input which is a number. What is the format of that number inside the function. The reason I ask is that I was trying to define a variable as follows
function pippo(len)
a = len +1;
which gives me the following error: "Index exceeds matrix dimensions."
0 comentarios
Respuestas (1)
  Walter Roberson
      
      
 el 24 de Mzo. de 2017
        I suspect that you accidentally assigned a value to a variable with the same name as your function, so you got a variable reference instead of a function reference. For example if you had
   peppo = peppo(164)
then the first time peppo would refer to the function, but the result would be assigned to the variable peppo and then the next time peppo(164) would try to index position 164 of that variable.
4 comentarios
  Walter Roberson
      
      
 el 25 de Mzo. de 2017
				Please post the complete routine, and an exact copy of the error message. Actually, please attach the file that has the code instead of just copy and paste it here.
Ver también
Categorías
				Más información sobre File Operations 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!

