LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with data formatting!

Hi, I'm attaching the text file as well as vi. I'm basically getting all the data and storing it into the text file. When the for loop iterates for the first time, I store the frequency and mag from the analyser into text file. Next time when it iterates I store the frequency and phase. Now problem is both the phase and magnitude get appended in the same coloumn. What I want is in the first iteration my data should get stored in coloumn 1 and coloumn two(i.e. frequency and mag) and in the next iteration it should get added into coloumn 3 and coloumn4(i.e.  frequency and phase)
Can anyone help how to embed a tab b/w the two iterations.
looking for help

Download All
0 Kudos
Message 1 of 8
(2,659 Views)

From what I can tell from your VI, you are collecting all the frequency and mag data, writing it one line at a time to the text file, then in the next iteration of the main for loop you are collecting all of the frequency and phase data and writing it one line at a time to the text file.

Instead of writing one line of data at a time in a for loop, write all your data at the end. That way you have all your data together at once to format in any way you like. And that way you can use the 'write to spreadsheet file' funtion and write all your data in one hit.

Message Edited by Troy K on 06-28-2007 12:48 PM

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 2 of 8
(2,653 Views)
Hi,
In the attached vi, I've removed the for loop and instead placed a flat sequence. Will this work??
As you can figure out in the first block the constact value attached to display format of set format.vi is 0 and in the other is 1 for magnitude and phase. But the prime condition is that in this flat sequence, the first block should run and only after it's finish the second block should start.
And than as you can see I'm joining both the clusters from the individual blocks using format into string pallete, to get frequency,magnitude and phase in three coloumns.
Will this alternative work??
Regards
0 Kudos
Message 3 of 8
(2,641 Views)

Yeah I think that will work, it is still writing one line at a time which is very inefficient.

You could also do it this way... (I've disabled your data acquisition code and simulated data)

All data written once at the end

Message Edited by Troy K on 06-28-2007 01:44 PM

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 4 of 8
(2,640 Views)
Yeah, that works perfect!
Heu could you also please tell me how, did you disabled my code and wrote the dice one over it. I'm really curious to know how do you disable particular section of code!!
0 Kudos
Message 5 of 8
(2,635 Views)

In the structures pallet there is a diagram disable structure.

http://zone.ni.com/reference/en-XX/help/371361B-01/glang/diagram_disable_structure/

the dice icon is a random number generator in the number pallet.

There is an even more efficient way to format your data at the end... it doesn't allow you to format each column individually though.

This is the 'write to spreadsheet file' VI I mentioned.

Message Edited by Troy K on 06-28-2007 02:01 PM

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 6 of 8
(2,632 Views)
Sorry, I'm unable to find Write spreadsheet file in my DirectorySmiley Sad
Can you attach or provide me the path...
0 Kudos
Message 7 of 8
(2,626 Views)
You can do a search in the pallet (click the search button (magnifying glass icon) in the top right hand corner of the pallet).
It's the first icon in the File I/O pallet.
 
Path to VI:  C:\Program Files\National Instruments\LabVIEW 8.2\vi.lib\Utility\file.llb\Write To Spreadsheet File (DBL).vi
 
Pallet location...

Message Edited by Troy K on 06-28-2007 02:47 PM

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 8 of 8
(2,623 Views)