<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 01/06/2018 à 12:46, Carrico, Paul a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:3A6B7233274DB449A2A0053A47684F953F98F296@BGS-EX01.auxitrol.ad">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@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:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
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
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
pre
{mso-style-priority:99;
mso-style-link:"Préformaté HTML Car";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
span.PrformatHTMLCar
{mso-style-name:"Préformaté HTML Car";
mso-style-priority:99;
mso-style-link:"Préformaté HTML";
font-family:Consolas;
color:black;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
lang="EN-US">Evstr(resu(k)) is a paste error - I’m reading
an asci file
</span><span
style="font-size:11.0pt;font-family:Wingdings;color:#1F497D"
lang="EN-US">J</span><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
lang="EN-US"><o:p></o:p></span></p>
<p><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
lang="EN-US">Without using a loop, I would like to get the n
th component of the vector resu(k) … k is no more no less
than the index of specific lines I’m trying to get …<o:p></o:p></span></p>
<p><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
lang="EN-US">Through your answers I’m understanding that I’m
thinking on a bad way</span></p>
</div>
</blockquote>
<br>
I think you can achieve what you want to do without a for loop.<br>
But my feeling is that there is something wrong with the way you
index your matrix NodesMatrix2(i,j+1) and your results resu(k).<br>
When you index with "i" and "j+1" that are vectors of length N &
M, you are basically indexing NxM elements of you matrix.<br>
This seems to be the core of the issue here.<br>
Maybe indexing your matrix like a vector (ie NodesMatrix2(p) with p
in [1:length(NodesMatrix2)]) would be better.<br>
<br>
Antoine<br>
<br>
<blockquote type="cite"
cite="mid:3A6B7233274DB449A2A0053A47684F953F98F296@BGS-EX01.auxitrol.ad">
<div class="WordSection1">
<p><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
lang="EN-US"><o:p></o:p></span></p>
<p><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
lang="EN-US">Paul<o:p></o:p></span></p>
<p><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p></o:p></p>
<p><b><i><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:gray">EXPORT
CONTROL :
<br>
</span></i></b><b><span
style="font-size:10.0pt;font-family:"Arial","sans-serif"">Cet
email ne contient pas de données techniques<br>
This email does not contain technical data</span></b><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><a name="_____replyseparator"
moz-do-not-send="true"></a><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">De :</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
users [<a class="moz-txt-link-freetext" href="mailto:users-bounces@lists.scilab.org">mailto:users-bounces@lists.scilab.org</a>]
<b>De la part de</b> antoine monmayrant<br>
<b>Envoyé :</b> vendredi 1 juin 2018 11:55<br>
<b>À :</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<b>Objet :</b> [EXTERNAL] Re: [Scilab-users] submatrix
issue<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>Hello,<o:p></o:p></p>
<p><o:p> </o:p></p>
<p>What do you wan to achieve exactly?<br>
As Stéphane pointed out, the sizes are not the same.<br>
When you assign something like:<o:p></o:p></p>
<p>A=B;<o:p></o:p></p>
<p>You have two different situations:<o:p></o:p></p>
<p>1) size(A)==size(B)<br>
2) size(B)=[1,1]<o:p></o:p></p>
<p>In the first case, you assign each element of B to each
element of A. In the latter case (which corresponds to your
commented line), B is just a scalar that gets assigned to each
element of A.<br>
<br>
In the current situation, you are neither in case 1) nor in
case 2).<br>
As you have size(NodesMatrix2(i,j+1))=[300,300] and
size(resu(k))=[300,1], you might want to replicate resu(k) 300
times and fill NodesMatrix2(i,j+1) with these 300 copies. If
this what you want to do, here is the code:<o:p></o:p></p>
<p>NodesMatrix2(i,j+1)=resu(k)*ones(1,300);<o:p></o:p></p>
<p><o:p> </o:p></p>
<p>By the way, why do you use "evstr(resu(k))" instead of
"resu(k)"?<o:p></o:p></p>
<p><o:p> </o:p></p>
<p>Antoine<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Le 01/06/2018 à 11:45, Stéphane Mottelet
a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">It cannot work since <br>
<br>
--> size(k) <br>
ans = <br>
<br>
300. 1. <br>
<br>
<br>
--> length(i)*length(j) <br>
ans = <br>
<br>
90000. <br>
<br>
i.e. NodesMatrix2(i,j+1) has 90000 elements and resu(k) has
300 <br>
<br>
S. <br>
<br>
Le 01/06/2018 à 11:07, Carrico, Paul a écrit : <br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><br>
Dear all <br>
<br>
I’ve a submatrix issue on the following example, and I do
not remember (or understand) why : how can I do this ?
<br>
<br>
(the goal is to extract and to store within a matrix results
from an Ascii file) <br>
<br>
Thanks for any help <br>
<br>
Paul <br>
<br>
############################################################### <br>
<br>
mode(0) <br>
<br>
clearall <br>
<br>
StartNodeLine= 1; <br>
<br>
NumberOfNodes= 100; <br>
<br>
DimCoordinates= 3; <br>
<br>
resu= rand(1000,1); <br>
<br>
tic(); <br>
<br>
NodesMatrix2= zeros(NumberOfNodes,DimCoordinates+1); <br>
<br>
i= [1 : NumberOfNodes]'; NodesMatrix2(i,1) =
_evstr_(resu(StartNodeLine + (DimCoordinates+2)*(i-1)+2));
<br>
<br>
i= [1 : NumberOfNodes]'.*.ones(1,DimCoordinates)'; <br>
<br>
j= ones(1,NumberOfNodes)'.*.[1 : DimCoordinates]'; <br>
<br>
k= StartNodeLine + (DimCoordinates+2)*(i-1)+3+j; <br>
<br>
a= _evstr_(resu(k)); <br>
<br>
NodesMatrix2(i,j+1)= _evstr_(resu(k)); /// does not work/ <br>
<br>
///NodesMatrix2(i,j+1) = 1; // work(basic assignement)/ <br>
<br>
Duration2= toc() <br>
<br>
*/EXPORT CONTROL : <br>
/**Cet email ne contient pas de données techniques <br>
This email does not contain technical data* <br>
<br>
<br>
<br>
_______________________________________________ <br>
users mailing list <br>
<a href="mailto:users@lists.scilab.org"
moz-do-not-send="true">users@lists.scilab.org</a> <br>
<a
href="https://urldefense.proofpoint.com/v2/url?u=https-3A__antispam.utc.fr_proxy_1_c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy_lists.scilab.org_mailman_listinfo_users&d=DwMD-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=fOPIPj4x1fd9eOUJD7v02ZTsRx2YJgno3lkgkK1O5b8&s=jzcapXMklHaIuDt_60w1DlJCIqVOV-xY54WDwPzYsNY&e="
moz-do-not-send="true">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
<o:p></o:p></p>
<p class="MsoNormal"><br>
<br>
<br>
<br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>users mailing list<o:p></o:p></pre>
<pre><a href="mailto:users@lists.scilab.org" moz-do-not-send="true">users@lists.scilab.org</a><o:p></o:p></pre>
<pre><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.scilab.org_mailman_listinfo_users&d=DwMD-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=fOPIPj4x1fd9eOUJD7v02ZTsRx2YJgno3lkgkK1O5b8&s=qWqrTkz0H8OBLBxbPldRtat8qjyFFW2cf-apUFUk8wM&e=" moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<!--'"--><br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Antoine Monmayrant LAAS - CNRS
7 avenue du Colonel Roche
BP 54200
31031 TOULOUSE Cedex 4
FRANCE
Tel:+33 5 61 33 64 59
email : <a class="moz-txt-link-abbreviated" href="mailto:antoine.monmayrant@laas.fr">antoine.monmayrant@laas.fr</a>
permanent email : <a class="moz-txt-link-abbreviated" href="mailto:antoine.monmayrant@polytechnique.org">antoine.monmayrant@polytechnique.org</a>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
</pre>
</body>
</html>