[Scilab-users] [EXTERNAL] Re: submatrix issue

Carrico, Paul paul.carrico at esterline.com
Fri Jun 1 11:58:15 CEST 2018


Thanks Stephane for your answer, nonetheless:

size i = size j = size k = 300. 1.

And if you uncomment the line with assignment to 1, the final size is (100x4) as expected
//NodesMatrix2(i,j+1) = 1; // work(basic assignment)

Am I wrong to think that "evstr(resu(k)" assign the n th value of the k vector ? it has worked for "NodesMatrix2(i,j+1)" ...

Paul
###########################
mode(0)
clear all

StartNodeLine = 1;
NumberOfNodes = 100;
DimCoordinates = 3;
resu = rand(1000,1);

tic();
NodesMatrix2 = zeros(NumberOfNodes,DimCoordinates+1);
//i = [1 : NumberOfNodes]'; NodesMatrix2(i,1) = evstr(resu(StartNodeLine + (DimCoordinates+2)*(i-1)+2));
i = [1 : NumberOfNodes]'.*.ones(1,DimCoordinates)';
j = ones(1,NumberOfNodes)'.*.[1 : DimCoordinates]';
k = StartNodeLine + (DimCoordinates+2)*(i-1)+3+j;

a = evstr(resu(k));

//NodesMatrix2(i,j+1) = evstr(resu(k)); // does not work
NodesMatrix2(i,j+1) = 1; // work
Duration2 = toc()


EXPORT CONTROL :
Cet email ne contient pas de données techniques
This email does not contain technical data

De : users [mailto:users-bounces at lists.scilab.org] De la part de Stéphane Mottelet
Envoyé : vendredi 1 juin 2018 11:45
À : users at lists.scilab.org
Objet : [EXTERNAL] Re: [Scilab-users] submatrix issue

It cannot work since

--> size(k)
 ans  =

   300.   1.


--> length(i)*length(j)
 ans  =

   90000.

i.e. NodesMatrix2(i,j+1) has 90000 elements and resu(k) has 300

S.

Le 01/06/2018 à 11:07, Carrico, Paul a écrit :
Dear all
I've a submatrix issue on the following example, and I do not remember (or understand) why : how can I do this ?
(the goal is to extract and to store within a matrix results from an Ascii file)
Thanks for any help
Paul
###############################################################
mode()
clear all

StartNodeLine = 1;
NumberOfNodes = 100;
DimCoordinates = 3;
resu = rand(1000,1);

tic();
NodesMatrix2 = zeros(NumberOfNodes,DimCoordinates+1);
i = [1 : NumberOfNodes]'; NodesMatrix2(i,1) = evstr(resu(StartNodeLine + (DimCoordinates+2)*(i-1)+2));
i = [1 : NumberOfNodes]'.*.ones(1,DimCoordinates)';
j = ones(1,NumberOfNodes)'.*.[1 : DimCoordinates]';
k = StartNodeLine + (DimCoordinates+2)*(i-1)+3+j;

a = evstr(resu(k));

NodesMatrix2(i,j+1) = evstr(resu(k)); // does not work
//NodesMatrix2(i,j+1) = 1; // work(basic assignement)
Duration2 = toc()




EXPORT CONTROL :
Cet email ne contient pas de données techniques
This email does not contain technical data





_______________________________________________

users mailing list

users at lists.scilab.org<mailto:users at lists.scilab.org>

https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users<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=04fPhT_QbpiN8oBoi6JwWDBRtpUgIuY5s4aUq3ieOfg&s=y8LL_brV9V6sopAHxT2aQP3hmtESeECf25ZAXAizixU&e=>



--

Stéphane Mottelet

Ingénieur de recherche

EA 4297 Transformations Intégrées de la Matière Renouvelable

Département Génie des Procédés Industriels

Sorbonne Universités - Université de Technologie de Compiègne

CS 60319, 60203 Compiègne cedex

Tel : +33(0)344234688

http://www.utc.fr/~mottelet<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.utc.fr_-7Emottelet&d=DwMD-g&c=0hKVUfnuoBozYN8UvxPA-w&r=4TCz--8bXfJhZZvIxJAemAJyz7Vfx78XvgYu3LN7eLo&m=04fPhT_QbpiN8oBoi6JwWDBRtpUgIuY5s4aUq3ieOfg&s=T0ehMnqKVv6p0BcBqBHILev-kfq88WBC6ipqAf7pS3s&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180601/53d6f246/attachment.htm>


More information about the users mailing list