The problem has already been pointed out here :

http://bugzilla.scilab.org/show_bug.cgi?id=15206

S.

Le 10/01/2019 à 16:40, Stéphane Mottelet a écrit :
Hello,

With Scilab 6.0.1 under OSX or Linux, and your script

len = 10000 ;
fid = mopen(fullfile(TMPDIR,'Scilab.bin'),'wb+');
mput (int16([1:len]), 's', fid ) ;
mt1 = mtell(fid) ;
mseek(0, fid) ;
rm = mget(len, 's', fid);
mclose(fid);
printf('%i %i', mt1, length(rm))

I got the expected answer:

20000 10000
--> mt1
 mt1  =

   20000.

However, I confirm that under Scilab 6.0.1 under Windows 7 I got the same result as yours:

20296 25
--> mt1
 mt1  =

   20296.

This is somewhat related to https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/bugzilla.scilab.org/show_bug.cgi?id=3684

In order to have the correct behavior change "w+" to "wb+" in the mopen

I will create a bug report on https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/bugzilla.scilab.org


S.


Le 10/01/2019 à 15:35, yannick a écrit :
Hello,

I try to go from MatLab to SciLab.

I am a little disturbed by my first tests, maybe the change of context ...

I'm probably using the instructions incorrectly, but my mistake is so huge
that I can not see it.
Can you help me open my eyes?

The following code:
*
len = 10000 ;
fid = mopen( 'C:\Users\yoon\Documents\MATLAB\Dorian\SciLab.bin' , 'w+' );

    mput ( int16([1:len]), 's', fid ) ;      mt1 = mtell(fid) ;
    mseek( 0 , fid  ) ;
    rm = mget(len, 's', fid);

mclose(fid);

printf('%i %i', mt1, length(rm))
*
creates a file of 20296 bytes. I expected exactly 20000...
mt1 == 20296.
Moreover "mget" reads only 25 short words.

If I simply changes "[1:len]" for "zeros(1,len)", every thing becomes ok,
(file size and rm length).

If I use double words instead short  " mput ( [1:len], 'd', fid ) ; "
  the file size is 80040    and rm's length 2060 !!!

   What's missing me?

   Thank's in advance,
    Yannick



--
Sent from: https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users



--
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

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to