[Scilab-users] Passing argument to function by reference

Laurent Cetinsoy lce at creativ-ceutical.com
Fri Nov 16 10:37:51 CET 2012


Dear all, 

 

For a simulation, I need to update a matrix in a loop. The thing is, I only
need to update a few rows. And since this code is to be used in different
part, I would like to include it in a function. Beside I would like to avoid
using “global” variable. 

 

Here is it what I want to do : 

 

myMat = zeros(nrow, ncol)

 

For I =1 :i_max

 

fUpdateMat( reference myMat)

                etc


end

 

 

function fUpdateMat(Mat)

 

                Mat(2:3) = 


                Mat(4) = 


                Mat(10) = 


                Etc


 

end function

 

I do not want to include this into a scrip (.sce) file and execute it with
“exec” because reading a written file in a loop slows down the computation
greatly.

 

I would be pleased if you have any suggestion. 

 

Regards,

 

Laurent

__________________________________

Laurent Cetinsoy

Research Analyst

Health Economics and Outcomes Research

 

LOGO Q + CLAIM HD petite

215, rue du Faubourg St-Honoré

75008 Paris - France

Phone:  +33 1 76 70 47 90

Fax:        +33 1 53 75 49 24

 <http://www.creativ-ceutical.com/> www.creativ-ceutical.com

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121116/52b78d04/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 2292 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20121116/52b78d04/attachment.jpg>


More information about the users mailing list