Why this not works..?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 21 de Dic. de 2012

0 votos

What does not work about it? What error message is given?
One thing I notice is that in the code you show, if that is the entire code, then you are attempting to define a function inside a script. You need to convert the first part to a function. For example,
function testloop
n = 10;
for p = 1 : n
lal(p)
end
function [] = lal(p)
...

4 comentarios

Lalit Patil
Lalit Patil el 21 de Dic. de 2012
Editada: Lalit Patil el 21 de Dic. de 2012
This is the link for the function myFunction.m which i am using..
But now i want loop for imageNumber.. I have to use this function in GUI button. So, what modification i have to do..?
Walter Roberson
Walter Roberson el 21 de Dic. de 2012
What happened when you tried?
Lalit Patil
Lalit Patil el 21 de Dic. de 2012
d = dir('.');
n = length(d)-2;
for imageNumber = 1:n
myFunction(imageNumber)
end
It works now..
Problem get solved..
Image Analyst
Image Analyst el 21 de Dic. de 2012
Then officially mark it as solved. Looks just like what Walter said except that the function name is different.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by