Re: [Scilab-users] structures manipulation

2024-04-09 Thread Stéphane Mottelet

Yes, this would be almost the same code:
obj=struct();
obj.a=1;
obj.b=2;
obj.c=3;

tmp=fieldnames(obj);

for i=1:3
disp(obj(tmp(i)));
end

in Scilab fieldnames yields an array of strings (not a cell array) and struct 
indexing by a string is simpler (the dot is not needed).

S.

On 4/8/24 13:55, Collewet Guylaine wrote:
Hello,

Is it possible to do the same as this matlab code in scilab ?
thank you in advance

obj=struct();
obj.a=1;
obj.b=2;
obj.c=3;

tmp=fieldnames(obj);

for i=1:3
disp(obj.(tmp{i}));
end



Guylaine Collewet
[cid:part1.MthaV5ht.Rk5YK5cq@utc.fr]
ingénieur de recherche équipe 
IRMFOOD
guylaine.colle...@inrae.fr
UR 
OPAALE
17 avenue de Cucillé
35 044 Rennes Cedex
02 23 48 21 67 (ligne directe)
02 23 48 21 21 (standard)








This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email 
and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or 
responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data privacy policy as 
described on our website. Should you have any questions related to personal data protection, please 
contact 3DS Data Protection Officer 
https://www.3ds.com/privacy-policy/contact/




___
users mailing list - users@lists.scilab.org
Click here to unsubscribe: 

https://antiphishing.vadesecure.com/v4?f=Tjk1V3VNN1ZwOXJ4M1ZtSXYpKhlGklQFIa3ESKachb0fzLLMw7qyodiRY-7VTMyR=VUtMcVNzVlVHTVZEbklQWrD9JOSvtlMDgS4ACbqCWAA=aZch=ckFxODlvdUlOR3V6SFdjZCpcv1LQN58d2fuyHvJXTuFMGwveWarT_FN_zTC2TmlA=ca66b3a056bf4f65e5ac3f629e6fb7a57ef586399f35764e31826e7004364628=https%3A%2F%2Flists.scilab.org%2Fmailman%2Flistinfo%2Fusers


--
Stéphane Mottelet
Ingénieur de recherche HDR
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

This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email 
and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or 
responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data 
privacy policy as described on our website. Should you have any questions 
related to personal data protection, please contact 3DS Data Protection Officer 
https://www.3ds.com/privacy-policy/contact/

___
users mailing list - users@lists.scilab.org
Click here to unsubscribe: 
https://lists.scilab.org/mailman/listinfo/users


[Scilab-users] structures manipulation

2024-04-09 Thread Collewet Guylaine
Hello,

Is it possible to do the same as this matlab code in scilab ?
thank you in advance

obj=struct();
obj.a=1;
obj.b=2;
obj.c=3;

tmp=fieldnames(obj);

for i=1:3
disp(obj.(tmp{i}));
end



Guylaine Collewet
[cid:image001.png@01DA89BC.68CB93C0]
ingénieur de recherche équipe 
IRMFOOD
guylaine.colle...@inrae.fr
UR OPAALE
17 avenue de Cucillé
35 044 Rennes Cedex
02 23 48 21 67 (ligne directe)
02 23 48 21 21 (standard)








This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email 
and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or 
responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data 
privacy policy as described on our website. Should you have any questions 
related to personal data protection, please contact 3DS Data Protection Officer 
https://www.3ds.com/privacy-policy/contact/

___
users mailing list - users@lists.scilab.org
Click here to unsubscribe: 
https://lists.scilab.org/mailman/listinfo/users