error sign not valid
Mostrar comentarios más antiguos
I have this function
n = 1;
Product = 1;
while( Product < N )
{
Product = Product * (2*n);
n = n + 1;
}
end
and this error keeps on popping up Error: File: Untitled5.m Line: 5 Column: 9 The expression to the left of the equals sign is not a valid target for an assignment.
1 comentario
Jordan Monthei
el 9 de Mayo de 2013
Editada: Jordan Monthei
el 9 de Mayo de 2013
For readability sake, I'm going to add this on here.
% this loop is used to find how many iterations are needed in the expression 2*4*6*...*2n in order to exceed a predetermined maximum.
n=1;
Product = 1; % variables initialized as one
while ( Product < N) % N being a predetermined maximum
{
Product = Product * (2 * n); % 2*4*6*...*2n until
n = n + 1;
}
end
it would be helpful to know what the rest of the program is doing outside of this function. Is N declared, if so, what is it declared as? Where does Line: 5 Column: 9 correspond within what you have?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Functional Programming 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!