LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing a 2d array while adding non array based elements to txt file

Hello,

 

I'm trying to writing a 2d array from my DAQ to txt file while continuously adding the total test time, which is not an array to the same txt file. How do I do this? I have tried to use the build array while indexing the array, that didn't work. So I tried to use the initialize array that didn't work either. I would like the information in the txt to be written in columns instead rows which I was able to do by transposing the 2d array coming out of the DAQ but how do I do that for the total time? I posted the pic below, I'm using a consumer producer loop. The grey area is where I'm trying to do the array. Any information you can give me would be great.

 

Thanks for your time,

Steeltiki

 

writting problem.JPG

 

0 Kudos
Message 1 of 12
(3,520 Views)

Does anyone know how to sharpen the images? The picture I posted looked great and then I posted it and looks like the above. Ideas?

0 Kudos
Message 2 of 12
(3,519 Views)

Hopefully this is a better pic

writting problem.JPG

0 Kudos
Message 3 of 12
(3,504 Views)

Try a .png file.  They produce sharper images than .jpg files.

 

From the fuzzy images it looks like you have made all the beginner mistakes: overuse of local variables and property nodes where wires will work, wires hidden behind objects, ...

 

If you have not done so, please look at the on-line tutorials.

 

You can attach the VI itself and then we do not have to guess at the parts not shown in your images.

 

Lynn

0 Kudos
Message 4 of 12
(3,498 Views)

The actual program is very large so what I have included is a mock up of what trying to do. I realize that how the program is written with all the local variables is wrong and I intend to clean it all up after I get everything working.

Download All
0 Kudos
Message 5 of 12
(3,486 Views)

To add the total test time, use the "get current time" vi in the Time Pallette. Get current time outside the loop then subtract time current from beginning time using a shift register (on the loop).

 

Open up a Labview example on writing to files, click on Help "Find Example". When you write the time to the file add a carriage return to write in a columns. Consider whether you are writing entire arrays or just an 1 array value... Your question is a broad one but hopefully this will send you in the right direction.

0 Kudos
Message 6 of 12
(3,482 Views)

Hello,

With the information richjoh gave me in the last post I was able to get the time and the 2D DAQ array to read together. However that question was the easier one. I have posted a working sample program because the main program is too complex, in hopes that someone out there knows how to fix this issue. I am trying to read and write 9000 reads per second for a cDAQ 9178 using the Accelerometer module 9234. In addition to that data I also want to write to the same file the total test time, torque and speed which I’ve put as constants in the test program.  The grey area in the picture and the test program shows how I set up the array size and inserted those values into the array. The problem that I’m having in both the real program and test program is shown in the excel files (without transpose, real program) where time column shifts over one row every other reading. The second problem is how do I get the accelerometer data to read in columns instead of rows? You will notice this in the two excel files mention above. When I use the array transpose coming off the Accelerometer local variable it gives a data file where everything is zero except the accelerometer data shown in the excel file using transpose array.   Note that the writing of the files is done as txt. I only converted them to excel to make it easier to read. I’ve been stuck on this issue for nearly a month and I really need help.

 

Thanks for your time,

Steeltiki

test program 2.PNG

 

0 Kudos
Message 7 of 12
(3,427 Views)

There wasn't room to add the last attachment. So here it is.

0 Kudos
Message 8 of 12
(3,426 Views)

here's a better look at the picture. I didn't realize it was going to be that small

0 Kudos
Message 9 of 12
(3,425 Views)

Could you post your subVIs as well.  That would help us with pointing you in the right direction.

 

Brandon Treece

Applications Engineer

National Instruments

0 Kudos
Message 10 of 12
(3,369 Views)