[Scilab-users] CsvRead function

classic Classic list List threaded Threaded
9 messages Options
Daniel Stringari Daniel Stringari
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] CsvRead function

Dear colleagues,

I am using a code in the version of Scilab 6.1 that was made in version
Scilab 6.0.2. However, the same code that works in version 6.0.2, gives an
error when executed in version 6.1. The function pointed on the error screen
is always 'csvRead'.

<http://mailinglists.scilab.org/file/t498028/Piece_With_Error.png>

<http://mailinglists.scilab.org/file/t498028/Error.png>

any suggestion ?



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: CsvRead function

Hi

Le 11/05/2020 à 11:45, Daniel Stringari a écrit :

> Dear colleagues,
>
> I am using a code in the version of Scilab 6.1 that was made in version
> Scilab 6.0.2. However, the same code that works in version 6.0.2, gives an
> error when executed in version 6.1. The function pointed on the error screen
> is always 'csvRead'.
>
> <https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/file/t498028/Piece_With_Error.png>
>
> <https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/file/t498028/Error.png>
>
> any suggestion ?

Yes. Are you sure your file exists (considering the error message) ?

S.

>
>
>
> --
> Sent from: https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> [hidden email]
> 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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant Antoine Monmayrant
Reply | Threaded
Open this post in threaded view
|

Re: CsvRead function

In reply to this post by Daniel Stringari
Hello Daniel,

It seems to me that the error is more the absence of the file
"C:\Temp\PGC\Sai_Lot1v3.txt".

You can try to check just before line 206 whether the file is present or
not:
ls("C:\Temp\PGC\Sai_Lot1v3.txt") or isfile("C:\Temp\PGC\Sai_Lot1v3.txt") .

Hope it helps,

Antoine


On 11/05/2020 11:45, Daniel Stringari wrote:

> Dear colleagues,
>
> I am using a code in the version of Scilab 6.1 that was made in version
> Scilab 6.0.2. However, the same code that works in version 6.0.2, gives an
> error when executed in version 6.1. The function pointed on the error screen
> is always 'csvRead'.
>
> <http://mailinglists.scilab.org/file/t498028/Piece_With_Error.png>
>
> <http://mailinglists.scilab.org/file/t498028/Error.png>
>
> any suggestion ?
>
>
>
> --
> Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Daniel Stringari Daniel Stringari
Reply | Threaded
Open this post in threaded view
|

Re: CsvRead function

In reply to this post by mottelet
Good Morning,

The file exists ... Every time the code is run, it tries to create a series of files inside the address "C: \ Temp \ PGC \ ..." using the functions FULLFILE, CSVWRITE, CSVREAD and MDELETE to create and manipulate the data. This tool always worked in version 6.0.2 and when upgrading to version 6.1, it started to give an error with the code identical to the previous version, so my first suspicion was in relation to the mentioned functions.

On Mon, May 11, 2020 at 6:55 AM Stéphane Mottelet <[hidden email]> wrote:
Hi

Le 11/05/2020 à 11:45, Daniel Stringari a écrit :
> Dear colleagues,
>
> I am using a code in the version of Scilab 6.1 that was made in version
> Scilab 6.0.2. However, the same code that works in version 6.0.2, gives an
> error when executed in version 6.1. The function pointed on the error screen
> is always 'csvRead'.
>
> <https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/file/t498028/Piece_With_Error.png>
>
> <https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/file/t498028/Error.png>
>
> any suggestion ?

Yes. Are you sure your file exists (considering the error message) ?

S.

>
>
>
> --
> Sent from: https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> [hidden email]
> 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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant Antoine Monmayrant
Reply | Threaded
Open this post in threaded view
|

Re: CsvRead function


On 12/05/2020 10:20, Daniel Stringari wrote:
Good Morning,

The file exists ... Every time the code is run, it tries to create a series of files inside the address "C: \ Temp \ PGC \ ..." using the functions FULLFILE, CSVWRITE, CSVREAD and MDELETE to create and manipulate the data. This tool always worked in version 6.0.2 and when upgrading to version 6.1, it started to give an error with the code identical to the previous version, so my first suspicion was in relation to the mentioned functions.

OK, it's a bit weird.
Are you sure this file exists with the exact same name and capitalization (Windows file system should not car about capitalization, but just to be sure) ?
Can you give us the ouptut of "ls(Sai_Lot3v3)" ?

Can you:

(1) Provide us with a copy of the csv file Sai_Lot3v3 ?
(2) Generate a minimum working example that trigger this bug and share it with us?

This will help us helping you!

Cheers,

Antoine


On Mon, May 11, 2020 at 6:55 AM Stéphane Mottelet <[hidden email]> wrote:
Hi

Le 11/05/2020 à 11:45, Daniel Stringari a écrit :
> Dear colleagues,
>
> I am using a code in the version of Scilab 6.1 that was made in version
> Scilab 6.0.2. However, the same code that works in version 6.0.2, gives an
> error when executed in version 6.1. The function pointed on the error screen
> is always 'csvRead'.
>
> <https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/file/t498028/Piece_With_Error.png>
>
> <https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/file/t498028/Error.png>
>
> any suggestion ?

Yes. Are you sure your file exists (considering the error message) ?

S.

>
>
>
> --
> Sent from: https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> [hidden email]
> 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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
JLan JLan
Reply | Threaded
Open this post in threaded view
|

Re: CsvRead function

In reply to this post by Daniel Stringari

csvRead is quite strict regarding column structure etc, but the associated error message is typical "can not read......". So when it reports "does not exist", it looks like the file is missing, or misplaced. If you still think the file is there, you may try this script that I have used to check csv files:

//Read CSV file -JÅ 2020
datafile="test.csv";
separators=[ascii(9),";"];
decimal=",";
headerlines=2;
linestoread=-1;// -1 for all
footerlines=2;
fid = mopen(datafile,'rb');
csvline=mgetl(fid,linestoread);
mclose(fid);
clear dataset;
n=size(csvline,1);
for k=1:n
    if k>headerlines && k<n-footerlines+1 then
       datatemp=strtod(strsplit(csvline(k),separators),decimal);
       dataset(k-headerlines,1:length(datatemp))=datatemp;
    end
end

disp(csvline(1:headerlines))
disp(dataset)
disp(csvline(($-footerlines+1):$))


Jan


On 2020-05-12 10:20 AM, Daniel Stringari wrote:
Good Morning,

The file exists ... Every time the code is run, it tries to create a series of files inside the address "C: \ Temp \ PGC \ ..." using the functions FULLFILE, CSVWRITE, CSVREAD and MDELETE to create and manipulate the data. This tool always worked in version 6.0.2 and when upgrading to version 6.1, it started to give an error with the code identical to the previous version, so my first suspicion was in relation to the mentioned functions.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: CsvRead function

Hello all, hello Daniel,

 

There has been some modification on the csvRead code to speed things up and there might be some issue in the new code. If you can reproduce with a reduced CSV file, could you open a bug with a sample of your code ?

 

Thanks,

 

--

Clément

 

 

From: users <[hidden email]> On Behalf Of Jan Åge Langeland
Sent: Tuesday, May 12, 2020 1:41 PM
To: Users mailing list for Scilab <[hidden email]>; Daniel Stringari <[hidden email]>
Subject: Re: [Scilab-users] CsvRead function

 

csvRead is quite strict regarding column structure etc, but the associated error message is typical "can not read......". So when it reports "does not exist", it looks like the file is missing, or misplaced. If you still think the file is there, you may try this script that I have used to check csv files:

//Read CSV file -JÅ 2020
datafile="test.csv";
separators=[ascii(9),";"];
decimal=",";
headerlines=2;
linestoread=-1;// -1 for all
footerlines=2;
fid = mopen(datafile,'rb');
csvline=mgetl(fid,linestoread);
mclose(fid);
clear dataset;
n=size(csvline,1);
for k=1:n
    if k>headerlines && k<n-footerlines+1 then
       datatemp=strtod(strsplit(csvline(k),separators),decimal);
       dataset(k-headerlines,1:length(datatemp))=datatemp;
    end
end
 
disp(csvline(1:headerlines))
disp(dataset)
disp(csvline(($-footerlines+1):$))

 

Jan

 

On 2020-05-12 10:20 AM, Daniel Stringari wrote:

Good Morning,


The file exists ... Every time the code is run, it tries to create a series of files inside the address "C: \ Temp \ PGC \ ..." using the functions FULLFILE, CSVWRITE, CSVREAD and MDELETE to create and manipulate the data. This tool always worked in version 6.0.2 and when upgrading to version 6.1, it started to give an error with the code identical to the previous version, so my first suspicion was in relation to the mentioned functions.

 

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Daniel Stringari Daniel Stringari
Reply | Threaded
Open this post in threaded view
|

Re: CsvRead function

This post was updated on .
CONTENTS DELETED
The author has deleted this message.
JLan JLan
Reply | Threaded
Open this post in threaded view
|

Re: CsvRead function

One thing I find is that csvRead does not seem to extract data correctly in 6.1.0 with "  " (double space) as separator.

test4.csv 
11  2  3  4
11  21  3  41

6.1.0

csvRead("test4.csv","  ")
 ans  =

   Nan   Nan   Nan   4.
   Nan   Nan   Nan   41.

6.0.2

 csvRead("test4.csv","  ")
 ans  =

   11.   2.    3.   4.
   11.   21.   3.   41.

Jan

On 2020-05-13 10:46 AM, Daniel Stringari wrote:
Good Morning,

I'll post snippets of the code in question. Thanks for the effort Jan, the
detail is that no matter how much the file exists when the code is run, the
same file is deleted at the beginning by the MDELETE function, afterwards
the code itself tries to create it again. This happens because this code
aims to extract data from a specific software and that is why I ended up not
sending the whole code at the beginning, considering that you would not be
able to run it without some repairs.

Daniel.

https://drive.google.com/open?id=1TFWO1RrEsF9SkrBAFUC3DPu6Mmanaapn
<https://drive.google.com/open?id=1TFWO1RrEsF9SkrBAFUC3DPu6Mmanaapn>  



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users