Borrar filtros
Borrar filtros

Saving previous values in a function to use them within it

39 visualizaciones (últimos 30 días)
John Doe
John Doe el 26 de Mayo de 2020
Comentada: John Doe el 27 de Mayo de 2020
Hi everyone,
This is a silly question but I don't know what I'm doing wrong.
I have a function that I'm running through a loop, within this function I need it to store a previous value because at a specific condition the code would require it.
for example
function [XX] = myfunction(Name,i)
.
.
.
Value{i} = yy
.
.
end
Now this function goes through a loop and as my i values increase I'd call for Value{i-1} at some point but it's not saving the previous values.
I feel like it's a simple thing but I don't know what it is.

Respuesta aceptada

Stephen23
Stephen23 el 26 de Mayo de 2020

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements 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!

Translated by