LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

import data from file become a matrix in labwindows

Hello, I'm Andi

I am a new comer from indonesia,

I try to study about labwindows for my task from lecture.

 

how to load/import data from file (ex:from notepad) and make from it become a matrix....

 

Thanks for the answer

 

Best regard.

Andi

Batam
0 Kudos
Message 1 of 5
(3,031 Views)

Hi Andy

 

you have an example in CVI that takes a Waveform transfore it to a graph and then saving the data in file.

 

National Instruments\CVI2009\samples\fileio\arrayfile.cws

 

it will help you understand

 

Kobi

 

 

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 2 of 5
(3,024 Views)
thanks for kobi I try to load/import data from file, than I will use the data to make a matrix... how can I do it? thanks a lot
Batam
0 Kudos
Message 3 of 5
(3,019 Views)

There are multiple ways to realize what you want to do.

 

One simple way is (1) use FileToArray(...) function to read all data into a 1-D arrary and (2) use a standard C loop to parse and rearrange the data into a 2-D array (matrix).

 

Please post your code so people can understand your problem better and help you.

0 Kudos
Message 4 of 5
(2,981 Views)

Some more hints on this:

- FileToArray can directly generate a 2d array if you are starting from an ASCII file (which seems s your case: notepad)

- You need to know the number of rows/columns to dimension the array prior to calling FilToArray

- FileToArray cannot handle files with mixed text/numbers elements: if this is your case you will need to use some low level functions to open the file and scan it

 

If you can post a sample data file we can be more precise in our suggestions.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(2,971 Views)