In a function we need to input the first element of matrix?
Mostrar comentarios más antiguos
for say let the function be
function[d]=myFIRST(x,y)
for i=1:100
y(i+1)=x+y(i)
d=y;
end
end
myFIRST(1,2)
here y is iteratively changing and the first element is defined.
it doesnt read iteratively new values
4 comentarios
Davide Masiello
el 10 de En. de 2023
Could you please clarify what your expected output is?
Dyuman Joshi
el 10 de En. de 2023
It is not clear what exactly you want to do with given code piece. Please mention what is it that you are trying to achieve, what problem you are facing and what your expected output is, as Davide Masiello asks as well.
PARVATHY NAIR
el 10 de En. de 2023
That's not the case for me, all the iterations are displayed.
myFIRST(1,2)
function[d]=myFIRST(x,y)
for i=1:100
y(i+1)=x+y(i)
d=y;
end
end
Respuestas (1)
hello
simply this. personnay I don't like to use the same variable name in both iput and output of a function .
y = myFIRST(1,2)
function[y]=myFIRST(x,y)
for i=1:100
y(i+1)=x+y(i);
end
end
2 comentarios
Stephen23
el 23 de En. de 2023
"I don't like to use the same variable name in both iput and output of a function."
Dyuman Joshi
el 23 de En. de 2023
Editada: Dyuman Joshi
el 23 de En. de 2023
Thank you for the comment, @Stephen23. This was something I was looking for, but couldn't word it properly when I asked this question - Replacing Arrays and Matrices
Can you edit your answer on my question to include this info? So I can accept your answer.
Categorías
Más información sobre Matrix Indexing 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!