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:[email protected]]
ingénieur de recherche équipe
IRMFOOD<https://antiphishing.vadesecure.com/v4?f=Tjk1V3VNN1ZwOXJ4M1ZtSXYpKhlGklQFIa3ESKachb0fzLLMw7qyodiRY-7VTMyR&i=VUtMcVNzVlVHTVZEbklQWrD9JOSvtlMDgS4ACbqCWAA&k=aZch&r=ckFxODlvdUlOR3V6SFdjZCpcv1LQN58d2fuyHvJXTuFMGwveWarT_FN_zTC2TmlA&s=91f6ba6ea55cb009a3fef6a802f0318b1a2a7f51cb178081fa23889ce5bdcfff&u=https%3A%2F%2Fwww6.rennes.inrae.fr%2Fopaale%2FRECHERCHE%2FEQUIPES-DE-RECHERCHE%2FIRM-Food>
[email protected]<mailto:[email protected]>
UR
OPAALE<https://antiphishing.vadesecure.com/v4?f=Tjk1V3VNN1ZwOXJ4M1ZtSXYpKhlGklQFIa3ESKachb0fzLLMw7qyodiRY-7VTMyR&i=VUtMcVNzVlVHTVZEbklQWrD9JOSvtlMDgS4ACbqCWAA&k=aZch&r=ckFxODlvdUlOR3V6SFdjZCpcv1LQN58d2fuyHvJXTuFMGwveWarT_FN_zTC2TmlA&s=511268892a0a4af586e083fe9238910b9fee19188f134b6bf48c9651741d1a97&u=https%3A%2F%2Fopaale.rennes.hub.inrae.fr%2F>
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/<https://antiphishing.vadesecure.com/v4?f=Tjk1V3VNN1ZwOXJ4M1ZtSXYpKhlGklQFIa3ESKachb0fzLLMw7qyodiRY-7VTMyR&i=VUtMcVNzVlVHTVZEbklQWrD9JOSvtlMDgS4ACbqCWAA&k=aZch&r=ckFxODlvdUlOR3V6SFdjZCpcv1LQN58d2fuyHvJXTuFMGwveWarT_FN_zTC2TmlA&s=1f129521d6150c0988c4c9da9117316cf758c3428bd22179f3fef13ed07a634b&u=https%3A%2F%2Fwww.3ds.com%2Fprivacy-policy%2Fcontact%2F>
_______________________________________________
users mailing list - [email protected]<mailto:[email protected]>
Click here to unsubscribe:
<mailto:[email protected]><mailto:[email protected]>
https://antiphishing.vadesecure.com/v4?f=Tjk1V3VNN1ZwOXJ4M1ZtSXYpKhlGklQFIa3ESKachb0fzLLMw7qyodiRY-7VTMyR&i=VUtMcVNzVlVHTVZEbklQWrD9JOSvtlMDgS4ACbqCWAA&k=aZch&r=ckFxODlvdUlOR3V6SFdjZCpcv1LQN58d2fuyHvJXTuFMGwveWarT_FN_zTC2TmlA&s=ca66b3a056bf4f65e5ac3f629e6fb7a57ef586399f35764e31826e7004364628&u=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 - [email protected]
Click here to unsubscribe: <mailto:[email protected]>
https://lists.scilab.org/mailman/listinfo/users