Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Passing the Value as Argument but not getting it in the function file
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hey.
I am passing value from loop.but don't recieve in the function file
Main:
for i=1 : size(Img_Out,1)
for j=1: size(Img_Out,2)
[iNew,jNew] = applyTransformation(i,j,Inverse_Of_Transformation_Matrix);
end
end
Function File:
function [iNew,jNew] = applyTransformation(xo,yo,Inverse_Of_Transformation_Matrix)
Old_Coordinates(1,1) = xo;
Old_Coordinates(2,1) = yo
end
When i output the value of xo i get "Undefined function or variable 'xo'." .Same is the case with other arguments. Please help
2 Commenti
Stephen23
il 18 Mag 2020
function [iNew,jNew] = applyTransformation(...)
% ^^^^ ^^^^ these are undefined in your function -> error
Risposte (1)
Fangjun Jiang
il 18 Mag 2020
In your function, you need to assign or return iNew,jNew
5 Commenti
Walter Roberson
il 18 Mag 2020
Variables defined inside a function disappear as soon as the function returns. You would need to put a breakpoint inside the function and examine the variables while stopped at the breakpoint.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!