Pass Variable By Reference To Function In Matlab

[Solved] Pass Variable By Reference To Function In Matlab | Matlab - Code Explorer | yomemimo.com
Question : pass variable by reference to function in matlab

Answered by : rasel-ahmed-9kilyai1mdfd

classdef myClass < handle properties data end methods function h = myClass(data) h.data = data ; end end
end
% Then defining a function (which could be a method) like
function myFunction(h) h.data = h.data+2;
end
% lets you do something like
h = myClass(0);
myFunction(h);
h.data
ans = 2

Source : | Last Update : Mon, 27 Jun 22

Answers related to pass variable by reference to function in matlab

Code Explorer Popular Question For Matlab