<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Baskerville Old Face";
        panose-1:2 2 6 2 8 5 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="2050" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Dear all, <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Here is it what I want to do : <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>myMat = zeros(nrow, ncol)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>For I =1 :i_max<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='text-indent:36.0pt'>fUpdateMat( reference myMat)<o:p></o:p></p><p class=MsoNormal>                etc…<o:p></o:p></p><p class=MsoNormal>end<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>function fUpdateMat(Mat)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                Mat(2:3) = …<o:p></o:p></p><p class=MsoNormal>                Mat(4) = …<o:p></o:p></p><p class=MsoNormal>                Mat(10) = …<o:p></o:p></p><p class=MsoNormal>                Etc…<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>end function<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I would be pleased if you have any suggestion. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Regards,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Laurent<o:p></o:p></p><p class=MsoNormal><span style='color:#00B0F0'>__________________________________</span><span style='font-size:12.0pt;font-family:"Baskerville Old Face","serif";color:#00B0F0'><o:p></o:p></span></p><p class=MsoNormal><b><span style='color:#404040'>Laurent Cetinsoy</span></b><b><span style='color:#404040'><o:p></o:p></span></b></p><p class=MsoNormal><i><span style='color:#404040'>Research Analyst<o:p></o:p></span></i></p><p class=MsoNormal><i><span style='color:#404040'>Health Economics and Outcomes Research<o:p></o:p></span></i></p><p class=MsoNormal><span style='font-size:8.0pt;color:gray'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:gray'><img width=183 height=44 id="Image_x0020_1" src="cid:image001.jpg@01CDC3E6.2305CED0" alt="LOGO Q + CLAIM HD petite"></span><span lang=FR style='color:gray'><o:p></o:p></span></p><p class=MsoNormal><span lang=FR style='font-size:10.0pt;color:gray'>215, rue du Faubourg St-Honoré</span><span lang=FR style='font-size:12.0pt;font-family:"Times New Roman","serif";color:#17365D'><o:p></o:p></span></p><p class=MsoNormal><span lang=FR style='font-size:10.0pt;color:gray'>75008 Paris - France</span><span lang=FR style='font-size:10.0pt;color:gray'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN style='font-size:10.0pt;color:gray'>Phone:  +33 1 76 70 47 90<o:p></o:p></span></p><p class=MsoNormal><span lang=EN style='font-size:10.0pt;color:gray'>Fax:        +33 1 53 75 49 24<o:p></o:p></span></p><p class=MsoNormal><span lang=FR><a href="http://www.creativ-ceutical.com/"><span lang=EN style='font-size:10.0pt;color:blue'>www.creativ-ceutical.com</span></a></span><u><span lang=EN style='font-size:10.0pt;color:gray'><o:p></o:p></span></u></p><p class=MsoNormal><span lang=FR><o:p> </o:p></span></p></div></body></html>