Re: [Scilab-users] Unexpected END OF FILE

2019-01-30 Thread Federico Miyara



Stéphane,

I mean, the doc says that binary mode for writing or reading is the 
default but it was not the case under Windows, where *text* mode was 
the default, and in this mode char of hex code 1A is EOF (in binary 
EOF is just a condition not a char).




Thank you for crlarifying. Now I completely understand the issue!

Regards,

Federico



---
El software de antivirus Avast ha analizado este correo electrónico en busca de 
virus.
https://www.avast.com/antivirus

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


Re: [Scilab-users] Unexpected END OF FILE

2019-01-30 Thread Stéphane Mottelet

Le 31/01/2019 à 07:27, Stéphane Mottelet a écrit :

Hello Frederico,

We just fixed it for Scilab 6.0.2, see

https://codereview.scilab.org/#/c/20688/ 



S.


I mean, the doc says that binary mode for writing or reading is the 
default but it was not the case under Windows, where *text* mode was the 
default, and in this mode char of hex code 1A is EOF (in binary EOF is 
just a condition not a char).


S.



Le 31 janv. 2019 à 01:20, Federico Miyara > a écrit :




Antoine,

Thank you VERY MUCH!

That works. Is there a fundamental reason why not specifying binary 
fails somewhere? Some sort of EOF code that may present itself 
randomly according to file content?


Regards,

Federico


On 30/01/2019 20:07, Antoine ELIAS wrote:

Hello Frederico,

On Windows, you should open your file in binary mode, with "rb".
--> fd = mopen("440Hz_0.2s.wav", "rb");
--> h = mgeti(1000, "uc", fd);
--> size(h)
 ans  =
   1.   1000.

--> dec2hex(h(1:5))
 ans  =
!52  49  46  46  84  !

Regards,
Antoine
Le 30/01/2019 à 23:02, Federico Miyara a écrit :


Dear all,

I'm trying to read data from a file (in this case a wave file) with 
the following code (Scilab 6.0.1)

fid  =  mopen('g:\Mis documentos\Ondas\440Hz_0.2s.wav',  'r')
mseek(0,  fid)
h  =  mgeti(1000,'uc',fid)
I should get a vector with 1000 unsigned 1 byte integer components 
but I end with only 164 entries. Viewing the file with an hex 
viewer, the last correctly read data are


34 3E 34 3E

(decimal 52 62 52 62)

Then the following data and further data

1A 3D 1A 3D  ...

are not read at all. No warning like having reached EOF. By the 
way, the repeated pairs are because it is a stereo file with 
identical left and right channels.


The same happens changing the way the file data are to be decoded. 
Seems to get stuck when 1A or 1A 3D appears.


Any idea of what may be going on and how to solve it?

Federico Miyara


<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

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




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


___
users mailing list
users@lists.scilab.org 
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users 



___
users mailing list
users@lists.scilab.org
https://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


Re: [Scilab-users] Unexpected END OF FILE

2019-01-30 Thread Stéphane Mottelet
Hello Frederico,

We just fixed it for Scilab 6.0.2, see 

https://codereview.scilab.org/#/c/20688/

S.

> Le 31 janv. 2019 à 01:20, Federico Miyara  a écrit :
> 
> 
> Antoine,
> 
> Thank you VERY MUCH!
> 
> That works. Is there a fundamental reason why not specifying binary fails 
> somewhere? Some sort of EOF code that may present itself randomly according 
> to file content?
> 
> Regards,
> 
> Federico
> 
> 
>> On 30/01/2019 20:07, Antoine ELIAS wrote:
>> Hello Frederico,
>> 
>> On Windows, you should open your file in binary mode, with "rb".
>> --> fd = mopen("440Hz_0.2s.wav", "rb");
>> --> h = mgeti(1000, "uc", fd);
>> --> size(h)
>>  ans  =
>>1.   1000.
>> 
>> --> dec2hex(h(1:5))
>>  ans  =
>> !52  49  46  46  84  !
>> 
>> Regards,
>> Antoine
>>> Le 30/01/2019 à 23:02, Federico Miyara a écrit :
>>> 
>>> Dear all,
>>> 
>>> I'm trying to read data from a file (in this case a wave file) with the 
>>> following code (Scilab 6.0.1)
>>> fid = mopen('g:\Mis documentos\Ondas\440Hz_0.2s.wav', 'r')
>>> mseek(0, fid)
>>> h = mgeti(1000,'uc',fid)
>>> I should get a vector with 1000 unsigned 1 byte integer components but I 
>>> end with only 164 entries. Viewing the file with an hex viewer, the last 
>>> correctly read data are
>>> 
>>> 34 3E 34 3E 
>>> 
>>> (decimal 52 62 52 62)
>>> 
>>> Then the following data and further data
>>> 
>>> 1A 3D 1A 3DÂ  ...
>>> 
>>> are not read at all. No warning like having reached EOF. By the way, the 
>>> repeated pairs are because it is a stereo file with identical left and 
>>> right channels.
>>> 
>>> The same happens changing the way the file data are to be decoded. Seems to 
>>> get stuck when 1A or 1A 3D appears.
>>> 
>>> Any idea of what may be going on and how to solve it?
>>> 
>>> Federico Miyara
>>> 
>>> 
>>> 
>>> 
>>> ___
>>> users mailing list
>>> users@lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>> 
>> 
>> 
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> 
> ___
> users mailing list
> users@lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Unexpected END OF FILE

2019-01-30 Thread Federico Miyara


Antoine,

Thank you VERY MUCH!

That works. Is there a fundamental reason why not specifying binary 
fails somewhere? Some sort of EOF code that may present itself randomly 
according to file content?


Regards,

Federico


On 30/01/2019 20:07, Antoine ELIAS wrote:

Hello Frederico,

On Windows, you should open your file in binary mode, with "rb".
--> fd = mopen("440Hz_0.2s.wav", "rb");
--> h = mgeti(1000, "uc", fd);
--> size(h)
 ans  =
   1.   1000.

--> dec2hex(h(1:5))
 ans  =
!52  49  46  46  84  !

Regards,
Antoine
Le 30/01/2019 à 23:02, Federico Miyara a écrit :


Dear all,

I'm trying to read data from a file (in this case a wave file) with 
the following code (Scilab 6.0.1)

fid  =  mopen('g:\Mis documentos\Ondas\440Hz_0.2s.wav',  'r')
mseek(0,  fid)
h  =  mgeti(1000,'uc',fid)
I should get a vector with 1000 unsigned 1 byte integer components 
but I end with only 164 entries. Viewing the file with an hex viewer, 
the last correctly read data are


34 3E 34 3E

(decimal 52 62 52 62)

Then the following data and further data

1A 3D 1A 3DÂ  ...

are not read at all. No warning like having reached EOF. By the way, 
the repeated pairs are because it is a stereo file with identical 
left and right channels.


The same happens changing the way the file data are to be decoded. 
Seems to get stuck when 1A or 1A 3D appears.


Any idea of what may be going on and how to solve it?

Federico Miyara


<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

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




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




---
El software de antivirus Avast ha analizado este correo electrónico en busca de 
virus.
https://www.avast.com/antivirus
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Unexpected END OF FILE

2019-01-30 Thread Antoine ELIAS

Hello Frederico,

On Windows, you should open your file in binary mode, with "rb".
--> fd = mopen("440Hz_0.2s.wav", "rb");
--> h = mgeti(1000, "uc", fd);
--> size(h)
 ans  =
   1.   1000.

--> dec2hex(h(1:5))
 ans  =
!52  49  46  46  84  !

Regards,
Antoine
Le 30/01/2019 à 23:02, Federico Miyara a écrit :


Dear all,

I'm trying to read data from a file (in this case a wave file) with 
the following code (Scilab 6.0.1)

fid  =  mopen('g:\Mis documentos\Ondas\440Hz_0.2s.wav',  'r')
mseek(0,  fid)
h  =  mgeti(1000,'uc',fid)
I should get a vector with 1000 unsigned 1 byte integer components but 
I end with only 164 entries. Viewing the file with an hex viewer, the 
last correctly read data are


34 3E 34 3E

(decimal 52 62 52 62)

Then the following data and further data

1A 3D 1A 3D  ...

are not read at all. No warning like having reached EOF. By the way, 
the repeated pairs are because it is a stereo file with identical left 
and right channels.


The same happens changing the way the file data are to be decoded. 
Seems to get stuck when 1A or 1A 3D appears.


Any idea of what may be going on and how to solve it?

Federico Miyara


<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

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


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


[Scilab-users] Unexpected END OF FILE

2019-01-30 Thread Federico Miyara


Dear all,

I'm trying to read data from a file (in this case a wave file) with the 
following code (Scilab 6.0.1)


fid  =  mopen('g:\Mis documentos\Ondas\440Hz_0.2s.wav',  'r')
mseek(0,  fid)
h  =  mgeti(1000,'uc',fid)

I should get a vector with 1000 unsigned 1 byte integer components but I 
end with only 164 entries. Viewing the file with an hex viewer, the last 
correctly read data are


34 3E 34 3E

(decimal 52 62 52 62)

Then the following data and further data

1A 3D 1A 3DÂ  ...

are not read at all. No warning like having reached EOF. By the way, the 
repeated pairs are because it is a stereo file with identical left and 
right channels.


The same happens changing the way the file data are to be decoded. Seems 
to get stuck when 1A or 1A 3D appears.


Any idea of what may be going on and how to solve it?

Federico Miyara


<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


---
El software de antivirus Avast ha analizado este correo electrónico en busca de 
virus.
https://www.avast.com/antivirus


440Hz_0.2s.wav
Description: Wave audio
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} Re: [EXTERNAL] Re: acos leads to complex values

2019-01-30 Thread Dang Ngoc Chan, Christophe
Hello,



> De : Federico Miyara

> Envoyé : mardi 29 janvier 2019 21:36

>

> This is an improved version of the acos function with input argument check:



I would personally write it in the following way:


function y=acos1(x)
// Check if components are real
// Check if components are real and belong to [-1, 1]
absx = abs(x);
in_domain = (imag(x)==0) & (-1<=absx) & (absx<=1);
// Imaginary part of acos(x) is accepted only if
// x does not belong to [-1, 1]
y=acos(x);
y(in_domain) = real(y(in_domain));
endfunction



Regards



--

Christophe Dang Ngoc Chan

Mechanical calculation engineer




Public

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users