LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ASC file to 2D boolean array

Solved!
Go to solution

Hey guys,

 

I was wondering if there is a method of uploading an *.ASC or *.DAT file to convert into a 2-D boolean array.

 

For example, I would create an .asc or .dat file composed of strings using MATLAB to generate

 

1 1 0 1 1 0 1 1

0 1 0 0 1 0 0 1

1 0 0 1 0 0 1 0

 

and it would convert the string to a 2-D boolean array of

 

T T F T T F T T

F T F F T F F T

T F F T F F T F

 

so that I can ultimately use it to create a modified Digital waveform graph like this:

18155i4C39087AD5103744

 

The purpose is because I will be using sample rates of 0.1 second intervals that spans to 2-5 minutes.

 

So to sum it up:

1. upload a *.ASC or *.DAT file with a 2-D array strings

2. convert the file to create a 2-D boolean array for use to create the digital waveform

 

Any help will be appreciated. I know it isn't much but I've uploaded the 2-D array to waveform *.VI for testing purposes.

0 Kudos
Message 1 of 5
(3,569 Views)

Use the Read From Spreadsheet set for integer and wire the 2D output to Nor Equal Zero function.

0 Kudos
Message 2 of 5
(3,559 Views)

Dennis,

 

Thanks for the help so far,

 

However, when I tried that first, it doesn't know how to separate each column of the *.asc file

 

1 0 0 1 0 0

0 1 1 0 1 1

 

turns out just to read the first column

 

T

F

 

18157iB4E06AE5DB06BDB6

 

therefore, I've been trying to find a way to work around so I posted here on a clean slate so I don't confuse people. If there is a way to fix this problem then that will be awesome 🙂

0 Kudos
Message 3 of 5
(3,551 Views)
Solution
Accepted by topic author sdkpark

 


@sdkpark wrote:

 

However, when I tried that first, it doesn't know how to separate each column of the *.asc file

 

1 0 0 1 0 0

0 1 1 0 1 1

 

turns out just to read the first column


Please attach your VI instead of a meaningless picture.

 

 

Read from spreadsheet file will read all 2D data if used correctly. The defined delimiter is separating items, and linefeed separating rows. For example if you don't wire the delimiter, it will assume "tab" and only one value will get read per line if it is actually a space character. Try a delimiter of "space".

0 Kudos
Message 4 of 5
(3,545 Views)

oh wow thanks very much. didn't know you can use space as delimiters.

 

thanks again.

0 Kudos
Message 5 of 5
(3,539 Views)