Storing Data from While loop
Mostrar comentarios más antiguos
Hello, I'm trying to create a matrix with the outputs of a while loop. Attached is an image which will help visualize what I'm doing. The y-axis is Y, and the x-axis is i.

Every time the y-value is at 4 I want to evaluate a function of those indices and store in a matrix. When the function is at 5 and returns to 4 I'd like to create a new index in the matrix and evaluate the function.
heres what i have
for i = (25600:26000)
while y == 4
for n = 1:50
A(n) = log (i)
else
A (n) = A (n+1)
end
end
Thanks for your help!
1 comentario
Stephen23
el 25 de En. de 2015
Do not use i (or j) as the names of your variables, as these are the names of the inbuilt imaginary unit .
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!