LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan array of numbers and plot a graph

Solved!
Go to solution

Hello,

 

I`m quite new in using labview and I`m now dealing with my first isue. I have got a text file of measured raw data. The text tile looks like this:

 

"Text Type";"Flexure"
"Final linear density";100.000000;"tex"
"Custom text input  1";""
"Time sec";"Extension mm";"Load N";"Flexure stress MPa";"Cycle Count ";"Total Cycle Count ";"Repetitions Count ";"Marked Data ";"PIP Count ";
0;0;0,3586976;-0,7188803;0;0;0;0;0;0;0;-0,3586976;0;0
0,01;0;0,3380042;-0,6774079;0;0;0;0;0;0;0;-0,3380042;0;0
0,03;-5,66667e-005;0,3339654;-0,6693135;0;0;0;0;0;5,66667e-005;0,0002499001;-0,3339654;0;-5,66667e-005

 

What I need is to extract numbers from first and second column (each column separated by ";") to an array and then transpose them so that I can plot them into a graph.

 

Could anyone help me or point me to the right study source?

 

I have tried to use Scan from File and Read from spreadsheet VIs but either didn`t work.

 

The description clarified in help is not clear enough for me.

 

Thank you a lot for helping me in doing first bigger steps with LabView.

 

Martin

 

0 Kudos
Message 1 of 7
(3,172 Views)
Solution
Accepted by topic author xombox@seznam.cz

Hi Martin,

you can use the "Read from Spreadsheet File" function. Use "Array Subset" on the result to get what you need and plot it into your graph.

 

Mike

Message 2 of 7
(3,171 Views)

Here's my first pass at parsing your data.  Perhaps I've missed your intention?

 

 

 

It's not pretty, but it'll get you started.

Message Edited by jcarmody on 03-31-2009 10:46 AM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Download All
Message 3 of 7
(3,148 Views)

jcarmody:

Thank you for possible solution and VI too. However, it seemed to me too much complicated and I don`t like loops 🙂

 

MikeS81:

Thanks for putting me in the right direction. I`ve managed it based on your recommended functions.The only problem that lefts is how to get rid off the initial mess in the file:

"Text Type";"Flexure"
"Final linear density";100.000000;"tex"
"Custom text input  1";""
"Time sec";"Extension mm";"Load N";"Flexure stress MPa";"Cycle Count ";"Total Cycle Count ";"Repetitions Count ";"Marked Data ";"PIP Count ";

 

I have tried to use "Match pattern" or "Match regular expression" as jcarmody showed in his solution. However, I think I get wrong the "offset past match". I would need something like " offset first match". Do you have any ideas how to solve this?

 

Martin

 


Message Edited by xombox@seznam.cz on 03-31-2009 06:14 PM
Download All
0 Kudos
Message 4 of 7
(3,126 Views)

Hi Martin,

do you habe a fixed number of initial lines? If yes, then you can use the Array Subset function with a constant to get only the values you want.

 

Mike

0 Kudos
Message 5 of 7
(3,103 Views)

Mike,

 

thank you for the tip. I also considered it but problem comes when there are more measured specimen. Then all the data are stored into one file so it looks like this:

 

"Text Type";"Flexure"
"Final linear density";100.000000;"tex"
"Custom text input  1";""

"Specimen 1"
"Time sec";"Extension mm";"Load N";"Flexure stress MPa";"Cycle Count ";"Total Cycle Count ";"Repetitions Count ";"Marked Data ";"PIP Count ";
0;0;0,3586976;-0,7188803;0;0;0;0;0;0;0;-0,3586976;0;0
0,01;0;0,3380042;-0,6774079;0;0;0;0;0;0;0;-0,3380042;0;0
0,03;-5,66667e-005;0,3339654;-0,6693135;0;0;0;0;0;5,66667e-005;0,0002499001;-0,3339654;0;-5,66667e-005

...

"Text Type";"Flexure"
"Final linear density";100.000000;"tex"
"Custom text input  1";""

"Specimen 2"

"Time sec";"Extension mm";"Load N";"Flexure stress MPa";"Cycle Count ";"Total Cycle Count ";"Repetitions Count ";"Marked Data ";"PIP Count ";
0;0;0,3586976;-0,7188803;0;0;0;0;0;0;0;-0,3586976;0;0
0,01;0;0,3380042;-0,6774079;0;0;0;0;0;0;0;-0,3380042;0;0
0,03;-5,66667e-005;0,3339654;-0,6693135;0;0;0;0;0;5,66667e-005;0,0002499001;-0,3339654;0;-5,66667e-005

 

I`m sorry, I didnt mention this fact before. However, it`s not important at this phase. I can handle it by writing several instructions for operators...

 

Thank you for very fast and helpful answers. My issue is solved.

 

I`m starting to like labview and its community 🙂

0 Kudos
Message 6 of 7
(3,093 Views)

The carrot in the regexp looks at the beginning of the string, if you remove it your regexp will return the index after the first number it finds.  This isn't quite right, either, because you can have numbers in your headers.  I changed the regexp as shown.  If you subtract the length of the match from the offset past the match (and increment) you'll get the position of the first data row.

 

 

PS - You'll still have to use loops when your file has multiple headers.  There are probably ways to do that with regular expressions, but I've never used them that way.

Message Edited by jcarmody on 04-01-2009 06:04 AM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 7 of 7
(3,079 Views)