Hi Richard ,
In previous I forgot to mention a msscanf()'s detail to iterate , optional  
niter= -1 (until the end of file)

r8= msscanf(-1, txt(:,8), "NET:     %3dx1 m3")      // iterate on specific data 
fixed format, 8th column
r1= msscanf(-1, txt(:,1), "%2d-%2d-%2d %2d:%2d:%2d")    // timestamps decoding, 
1st column

David

-----Message d'origine-----
De : CHEZE David 227480
Envoyé : mercredi 10 mai 2023 12:00
À : 'Users mailing list for Scilab' <users@lists.scilab.org>
Objet : RE: [Scilab-users] Need Help / Ideas on Log-File parsing

More specifically :

fchem="C:\Users\usr\Documents\scilab\TMP\data2impbzr.txt"       // sample text 
file with your data
txt= mgetl(fchem);  //read lines
txt(txt=="")=[];    //remove the empty lines
txt=matrix(txt,17,-1)'; //reshape the matrix

r8=msscanf(txt(:,8),"NET:     %3dx1 m3")        // for instance for 8th columns



-----Message d'origine-----
De : CHEZE David 227480
Envoyé : mercredi 10 mai 2023 11:33
À : 'Users mailing list for Scilab' <users@lists.scilab.org> Objet : RE: 
[Scilab-users] Need Help / Ideas on Log-File parsing

Hi Richard,

As first approach, i would read first whole file as vector of text lines, then 
keep only regular blocks of 17 lines: you got a matrix of strings size n*17  : 
throw every columns that you don't really need .
Then parse separately the timestamp column with appropriate token to construct 
vector of times.
Then, only for every columns vector of strings you are interested in, retrieve 
numerical values with csvTextScan for instance .

David


-----Message d'origine-----
De : users <users-boun...@lists.scilab.org> De la part de Richard Llom Envoyé : 
mercredi 10 mai 2023 10:59 À : users@lists.scilab.org Objet : [Scilab-users] 
Need Help / Ideas on Log-File parsing

Hello fellow scilab-users,
I need a script to read and process log-files, which are constructed as follows:

<file start>
23-05-10 10:00:45
SYS:*H
23-05-10 10:00:44 *H
Flow  0.0000  l/h
UP:51.1,DN:00.0,Q=11
FLOW: 0  l/h
VEL: 0 m/s
NET:     -68x1 m3
POS:   +5222x1 m3
NEG:   -5290x1 m3
EFR: 0 KW
ENET:   +5972E+0 KWh
EPOS:   +3079E+0 KWh
ENEG:   -2893E+0 KWh
FVEL: 2021.74 m/s
T1: 21.1632
T2: 21.4351

23-05-10 10:01:15
SYS:*H
23-05-10 10:01:14 *H
Flow  0.0000  l/h
UP:50.9,DN:00.0,Q=10
FLOW: 0  l/h
VEL: 0 m/s
NET:     -68x1 m3
POS:   +5222x1 m3
NEG:   -5290x1 m3
EFR: 0 KW
ENET:   +5972E+0 KWh
EPOS:   +3079E+0 KWh
ENEG:   -2893E+0 KWh
FVEL: 2081.19 m/s
T1: 21.1905
T2: 21.4544

23-05-10 10:01:45
SYS:*H
23-05-10 10:01:44 *H
Flow  0.0000  l/h
UP:51.5,DN:00.0,Q=09
FLOW: 0  l/h
VEL: 0 m/s
NET:     -68x1 m3
POS:   +5222x1 m3
NEG:   -5290x1 m3
EFR: 0 KW
ENET:   +5972E+0 KWh
EPOS:   +3079E+0 KWh
ENEG:   -2893E+0 KWh
FVEL: 2082.62 m/s
T1: 21.1985
T2: 21.4504

... [snip]
<file end>

Which is an absolutely stupid format ... :-(, to make matters worst there is 
one log-file created per day and I want to log over one month of data.

So far I have no idea how to takle this, because from what I see the usual 
msscanf and csvread expect data in row and columns. Any tip and ideas are 
welcome.

Thanks, with best regards
Richard
_______________________________________________
users mailing list - users@lists.scilab.org Click here to unsubscribe: 
<mailto:users-unsubscr...@lists.scilab.org>
https://lists.scilab.org/mailman/listinfo/users
This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email 
and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or 
responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data 
privacy policy as described on our website. Should you have any questions 
related to personal data protection, please contact 3DS Data Protection Officer 
https://www.3ds.com/privacy-policy/contact/

_______________________________________________
users mailing list - users@lists.scilab.org
Click here to unsubscribe: <mailto:users-unsubscr...@lists.scilab.org>
https://lists.scilab.org/mailman/listinfo/users
This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email 
and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or 
responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data 
privacy policy as described on our website. Should you have any questions 
related to personal data protection, please contact 3DS Data Protection Officer 
https://www.3ds.com/privacy-policy/contact/

Reply via email to