Re: [Scilab-users] Help with reading data (csvRead)
Hi Samuel OK, I trust it's just a matter of how the Mread matrix is displayed. /Claus On 10-12-2016 16:41, Samuel Gougeon wrote: Le 10/12/2016 16:18, Claus Futtrup a écrit : Hi Samuel Indeed it looks simpler than using csvRead, I will look into this function as well. It looks like it cuts off some of the decimals. Very unlikely. At least not a single one for the full file you sent to me: f = mgetl(filename); f(1:5) = []; s = sprintf("%9.3f %+10.4f %+10.4f \n",Mread); and(f==s) -->f = mgetl(filename); -->f(1:5) = []; -->s = sprintf("%9.3f %+10.4f %+10.4f \n",Mread); -->and(f==s) ans = T Trailing zeros are not displayed in the console. This can be misleading (and is unconvenient), but actual values are ok. Samuel ___ 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
Re: [Scilab-users] Help with reading data (csvRead)
Le 10/12/2016 16:18, Claus Futtrup a écrit : Hi Samuel Indeed it looks simpler than using csvRead, I will look into this function as well. It looks like it cuts off some of the decimals. Very unlikely. At least not a single one for the full file you sent to me: f = mgetl(filename); f(1:5) = []; s = sprintf("%9.3f %+10.4f %+10.4f \n",Mread); and(f==s) -->f = mgetl(filename); -->f(1:5) = []; -->s = sprintf("%9.3f %+10.4f %+10.4f \n",Mread); -->and(f==s) ans = T Trailing zeros are not displayed in the console. This can be misleading (and is unconvenient), but actual values are ok. Samuel ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Help with reading data (csvRead)
Hi Samuel Indeed it looks simpler than using csvRead, I will look into this function as well. It looks like it cuts off some of the decimals. Thanks for the tip. Best regards, Claus On 10-12-2016 15:54, Samuel Gougeon wrote: Claus, You may use simply [Mread, header] = fscanfMat(filename); tested on the file sent. There may be an equivalent with csvRead(), using the substitute option. To be confirmed. Anyway it would be more complicated than using fscanfMat(). BR Samuel Le 10/12/2016 15:26, Claus Futtrup a écrit : Hi Samuel I didn't mean for the Scilab Users list to design the script for me, only hint at what to do about csvRead (or use another function). The extracted few lines should be plenty to see my challenges. Attached is a complete ZMA file. Best regards, Claus ___ 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
Re: [Scilab-users] Help with reading data (csvRead)
Claus, You may use simply [Mread, header] = fscanfMat(filename); tested on the file sent. There may be an equivalent with csvRead(), using the substitute option. To be confirmed. Anyway it would be more complicated than using fscanfMat(). BR Samuel Le 10/12/2016 15:26, Claus Futtrup a écrit : Hi Samuel I didn't mean for the Scilab Users list to design the script for me, only hint at what to do about csvRead (or use another function). The extracted few lines should be plenty to see my challenges. Attached is a complete ZMA file. Best regards, Claus ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Help with reading data (csvRead)
Hi Rafael So I gather that the separator has to be a single character, when using csvRead. Thanks for the tip, I'll use mfscanf instead, it seems to be tolerant ... /Claus On 10-12-2016 15:31, Rafael Guerra wrote: Hi Claus, I do not know how to handle multiple spaces separators in csvRead, but you can use following code (adapted from recent post by Serge Steer): // START OF CODE: u=mopen("example.zma","r"); mgetl(u,5);// reads 5-line header r=mfscanf(-1,u,"%f %f %f\n"); mclose(u) // END OF CODE Regards, Rafael *From:*users [mailto:users-boun...@lists.scilab.org] *On Behalf Of *Claus Futtrup *Sent:* Saturday, December 10, 2016 11:23 AM *To:* International users mailing list for Scilab. <users@lists.scilab.org> *Subject:* [Scilab-users] Help with reading data (csvRead) Hi I'm trying to read a datafile with csvRead, it might be the wrong function. Please help. The file itself looks like this (only showing select lines - the file contains 391 lines): * FILE:C:\Users\claus\example.zma * INFO: Arb1 * Data: Impedance (ohms), Phase (degrees) 10.000+8.8488 +40.1693 10.199+8.9648 +40.7994 11.949 +10.0946 +46.1555 12.188 +10.2827 +46.7923 141.879+6.7485 -10.8804 144.715+6.7473 -10.3382 147.608+6.7438-9.8380 150.559+6.7377-9.3570 389.346+7.2282+9.7230 397.129+7.2456 +10.0717 987.112+8.5967 +23.3368 1006.846+8.6355 +23.7056 9807.309 +26.8760 +57.2720 10003.368 +27.2519 +57.4330 2.000 +44.3153 +62.1741 csvRead complains because the column width is changing. I execute: localdir = "C:\Users\claus\"; filename = _fullfile_(localdir,"example.zma"); Mread = csvRead(filename," ",".","double",[],[],[],5); This is the error which csvRead gives (line 10 == line 3 in above shortened dataset): >Warning: Inconsistency found in the columns. At line 10, found 12 columns while the previous had 13. > !--error 999 >csvRead: can not read file C:\Users\claus\example.zma: Error in the column structure What is the recommended way to read the ZMA file? P.S. ZMA = Impedance with 1) Frequency, 2) Magnitude and 3) Phase data. /Claus ___ 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
Re: [Scilab-users] Help with reading data (csvRead)
Hello Claus, Could you please post a true extract of your file, as a file /in attachement/, after that you checked than the issue occurs also with this extract file? It will be easier to test the issue, and it will lead to more reliable tests than copying/pasting a part of your message in a file. Regards SG Le 10/12/2016 11:22, Claus Futtrup a écrit : Hi I'm trying to read a datafile with csvRead, it might be the wrong function. Please help. The file itself looks like this (only showing select lines - the file contains 391 lines): * FILE:C:\Users\claus\example.zma * INFO: Arb1 * Data: Impedance (ohms), Phase (degrees) 10.000+8.8488 +40.1693 10.199+8.9648 +40.7994 11.949 +10.0946 +46.1555 12.188 +10.2827 +46.7923 141.879+6.7485 -10.8804 144.715+6.7473 -10.3382 147.608+6.7438-9.8380 150.559+6.7377-9.3570 389.346+7.2282+9.7230 397.129+7.2456 +10.0717 987.112+8.5967 +23.3368 1006.846+8.6355 +23.7056 9807.309 +26.8760 +57.2720 10003.368 +27.2519 +57.4330 2.000 +44.3153 +62.1741 csvRead complains because the column width is changing. I execute: localdir = "C:\Users\claus\"; filename = fullfile(localdir,"example.zma"); Mread = csvRead(filename,"",".","double",[],[],[],5); This is the error which csvRead gives (line 10 == line 3 in above shortened dataset): >Warning: Inconsistency found in the columns. At line 10, found 12 columns while the previous had 13. > !--error 999 >csvRead: can not read file C:\Users\claus\example.zma: Error in the column structure What is the recommended way to read the ZMA file? P.S. ZMA = Impedance with 1) Frequency, 2) Magnitude and 3) Phase data. /Claus ___ 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] Help with reading data (csvRead)
Hi I'm trying to read a datafile with csvRead, it might be the wrong function. Please help. The file itself looks like this (only showing select lines - the file contains 391 lines): * FILE:C:\Users\claus\example.zma * INFO: Arb1 * Data: Impedance (ohms), Phase (degrees) 10.000+8.8488 +40.1693 10.199+8.9648 +40.7994 11.949 +10.0946 +46.1555 12.188 +10.2827 +46.7923 141.879+6.7485 -10.8804 144.715+6.7473 -10.3382 147.608+6.7438-9.8380 150.559+6.7377-9.3570 389.346+7.2282+9.7230 397.129+7.2456 +10.0717 987.112+8.5967 +23.3368 1006.846+8.6355 +23.7056 9807.309 +26.8760 +57.2720 10003.368 +27.2519 +57.4330 2.000 +44.3153 +62.1741 csvRead complains because the column width is changing. I execute: localdir = "C:\Users\claus\"; filename = fullfile(localdir,"example.zma"); Mread = csvRead(filename,"",".","double",[],[],[],5); This is the error which csvRead gives (line 10 == line 3 in above shortened dataset): >Warning: Inconsistency found in the columns. At line 10, found 12 columns while the previous had 13. > !--error 999 >csvRead: can not read file C:\Users\claus\example.zma: Error in the column structure What is the recommended way to read the ZMA file? P.S. ZMA = Impedance with 1) Frequency, 2) Magnitude and 3) Phase data. /Claus ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users