Jump to content

Plotting a chart and saving it to a file


Recommended Posts

Hi there

I have been trying find my way around in doing the following, but in vain. I hope somebody could help me.

My aim: Is two plot two arrays on a waveform chart against the system time(computer time), on the same graph and also at the same time save the values (time, array1 and array2) to a file, with the column headers. The two array values are generated by the peak detection.vi inside a while loop. The plotting should continue until the STOP button is pressed. Also prefer not to clear the history, in the plot. for now the time should be the time when the values are generated

So far I am able to save the values to the file, including the column headers, by converting the values to string and saving it using "Write Characters to File.vi" .

But I cant get my way around plotting it against time. I tried many ways, including using bulid waveform(either it rejects for bad wiring or mostly it considers the two arrays as one one array).

Secondly, I have looked at some examples. The real-time chart.vi does the half the job I want. But it does not save the data. I tried extracting the values from the Property node- history, but I cant. even then it only gives the y values. The other intresting example is the Create waveform.vi. With that I cant find my way in converting the getdatetime .vi to float! Even then it does not let me wire the two arrays to the Y value.

It seems like I am missing something here, because it looks quite straightforward to me and should not be taking more than a day figure out. BTW I am new labview user!

Thanks in advance...

Link to comment

Thx for the welcome Louis!

After murking around for couples of days, it seems I have made some progress, in the process discovered the multiple use of build array function! But however I need to make some improvements.

I have attached a similar kind of vi, where the random vis generates the data, similar to peak detection (the actual vi I am working on).

I have added some explanations and request for help in the file itself.

At this moment I need to make the Array 1 remember all the past values without moving it outside the while loop. Also I get msg everytime whether it should replace the file,when it tries to save it. How can I make it the deault?

I need both the array values (random 1 and Random 2) to do an analysis similar to temperature system demo.vi in the examples. If somebdy can advise me on Array 1, I think I should be able to find my way with Random 2!

I hope I made sense so far!

Thanks for the help in advance!

BTW I'am using LabView7.1 and I do have access to version 6.

Download File:post-6356-1159887870.vi

Link to comment

Just to continue the thread and not to start a new one:

How can I write to a txt file and at same time accessview it, without any errors popping up?

Also if I want column headers in my file, (that is string) do i have to use :saving to txt file.vi or can saving to spreadsheet file?

Your help and guidance will be much appreciated!

Regards

Link to comment
How can I write to a txt file and at same time accessview it, without any errors popping up?

Also if I want column headers in my file, (that is string) do i have to use :saving to txt file.vi or can saving to spreadsheet file?

Open the file using the Advanced File Functions >> Open File with Deny Mode set to 2, then use the Read File and Write File nodes, setting the file pointer (or "mark") as needed.

Under the palette: File I/O >> Advanced File Functions >> Seek

The Seek primitive will set the file pointer (mark) to any location in the file you choose, for use by the other nodes. You will have to keep track of the file "housekeeping" yourself.

If you want columns you can create them yourself, but it would probably be easier to use the spreadsheet functions.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.