Re: [Scilab-users] Reading numericaldata from txt file containing headlines

2017-03-03 Thread Jens Simon Strom

Thanks Serge,

That seems to be the most convenient solution to me.

Regards,  Jens
---
Am 03.03.2017 21:58, schrieb Serge Steer:

You can proceed as follow without any change in your file:

u=mopen("myfile","r");
header=mgetl(u,4)

data=mfscanf(-1,u,"%f %f\n")

Le 03/03/2017 à 13:09, Jens Simon Strom a écrit :

Hi,
with
x=read(file,-1,2)
I can read the data from a text file containing e. g.

1  2.12   First line of text file
2.12   3.2
3 2
4  2
5 2.
6 2
7 2
Last line empty

What can I do to read only the numbers from a text file like

Header 1 First line of text file
Header 2


1 2.12
2.12 3.2
3 2
4 2
5 2.
6 2
7 2
Last line empty

where the data start in the 5th line?

Regards, Jens



___
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
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Reading numericaldata from txt file containing headlines

2017-03-03 Thread Serge Steer

You can proceed as follow without any change in your file:

u=mopen("myfile","r");
header=mgetl(u,4)

data=mfscanf(-1,u,"%f %f\n")

Le 03/03/2017 à 13:09, Jens Simon Strom a écrit :

Hi,
with
x=read(file,-1,2)
I can read the data from a text file containing e. g.

1  2.12   First line of text file
2.12   3.2
3 2
4  2
5 2.
6 2
7 2
Last line empty

What can I do to read only the numbers from a text file like

Header 1 First line of text file
Header 2


1 2.12
2.12 3.2
3 2
4 2
5 2.
6 2
7 2
Last line empty

where the data start in the 5th line?

Regards, Jens



___
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] Reading numericaldata from txt file containing headlines

2017-03-03 Thread Jens Simon Strom

Thanks Amanda, that helps.

In the meantime I have found an alternate way by editing the text file:
Move the leading text lines to the end of the data colums.
Append  a hint after the first data line that there is information below.
Use
x=read(file,r,c)
where r and c define the row and colum number of the numerical data. 
That works even for my chaotic data format wherein different numbers of 
blanks and tabs in each line  separate the data.


Regards, Jens

---


Am 03.03.2017 13:42, schrieb Amanda Osvaldo:

Hi,

if your data it's tabular, in another words, you can open it in Excel 
or Libre Office Calc like you whant to do.


You should be able to read in the same way with csvRead, however you 
need to adjust the parameters


Something like:

[M,comments] =csvRead('myfile.txt','',[],[],[],[],[],5);

Note that ' ' need to be the same separator in your text file.
*May be*  it can be a TAB (the key in keyboard) or a simple space, you need try 
or open your file and check it.

And the 5 value it's to ignore the first 5 lines.

https://help.scilab.org/docs/6.0.0/en_US/csvRead.html
Is that what you are looking for ?

-- Amanda Osvaldo

On Fri, 2017-03-03 at 13:09 +0100, Jens Simon Strom wrote:

Hi,
with
x=read(file,-1,2)
I can read the data from a text file containing e. g.

1  2.12   First line of text file
2.12   3.2
3 2
4  2
5 2.
6 2
7 2
Last line empty

What can I do to read only the numbers from a text file like

Header 1 First line of text file
Header 2


1 2.12
2.12 3.2
3 2
4 2
5 2.
6 2
7 2
Last line empty

where the data start in the 5th line?

Regards, Jens

___
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
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Reading numericaldata from txt file containing headlines

2017-03-03 Thread Amanda Osvaldo
Hi,
if your data it's tabular, in another words, you can open it in Excel
or Libre Office Calc like you whant to do.
You should be able to read in the same way with csvRead, however you
need to adjust the parameters
Something like:
[M, comments] = csvRead('myfile.txt', ' ', [], [], [], [], [],
5);
Note that ' ' need to be the same separator in your text file.May be it
can be a TAB (the key in keyboard) or a simple space, you need try or
open your file and check it.
And the 5 value it's to ignore the first 5 lines.
https://help.scilab.org/docs/6.0.0/en_US/csvRead.html
Is that what you are looking for ?
-- Amanda Osvaldo

On Fri, 2017-03-03 at 13:09 +0100, Jens Simon Strom wrote:
> Hi, 
> 
> with
> 
> x=read(file,-1,2)
> 
> I can read the data from a text file containing e. g. 
> 
> 
> 
> 1  2.12   First line of text file
> 
> 2.12   3.2
> 
> 3 2
> 
> 4  2
> 
> 5 2.
> 
> 6     2
> 
> 7 2 
> 
>     Last line empty
> 
> 
> 
> What can I do to read only the numbers from a text file like
> 
> 
> 
> Header 1 First line of text file
> 
> Header 2
> 
> 
> 
> 
> 
> 1 2.12
> 
> 2.12 3.2
> 
> 3 2
> 
> 4 2
> 
> 5 2.
> 
> 6 2
> 
> 7 2
> 
>     Last line empty  
> 
> 
> 
> 
> where the data start in the 5th line?
> 
> 
> 
> Regards, Jens
> 
> 
> 
>   
> 
> ___
> 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] Reading numericaldata from txt file containing headlines

2017-03-03 Thread Jens Simon Strom

Hi,
with

x=read(file,-1,2)

I can read the data from a text file containing e. g.

1  2.12   First line of text file
2.12   3.2
3 2
4  2
5 2.
6 2
7 2
Last line empty

What can I do to read only the numbers from a text file like

Header 1 First line of text file
Header 2


1 2.12
2.12 3.2
3 2
4 2
5 2.
6 2
7 2
Last line empty

where the data start in the 5th line?

Regards, Jens

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