04-10-2023 10:48 PM
@GRCK5000 wrote:
I made this change below and still missing data from the x-axis (0 to 999)
That code makes absolutely no sense!
04-11-2023 08:22 AM
If you need the time column you need to generate that array before the loop (assuming that the number of points is known and fixed.
You also need a shift register to pass the last time to the next iteration and continuously add the time to the reading , then the saving function will be wired as a 2D array, with True booleans for Append and Transpose (to have it as 2 columns).
04-11-2023 01:43 PM
@GRCK5000 wrote:
I tried but I'm only getting one column of the data. I'm not missing tank pressure column if only I can get the tank pressure, my problem will be solved. I don't even care much about the headers.
You need to be more clear. Both columns are labeled "tank pressure" in the excel export (one freq. and one PSI). If you are NOT missing it, so what's the problem?
You have a CSV file (NOT an Excel file, even if you later open it with Excel!!!) where you append one row of data with each iteration (i.e. all Y values of the graph, only the PSI column). I assume the frequency column is static across iterations, so you would only need to write that once, right? The information is in the waveform data, where you repurpose the timing information (t0, dt) generically as x0, dx. Nothing wrong with that.
If you right-click the graph and "export to excel", you get generic frequency values because you don't retain the original waveform metadata. This is a real Excel file! Big difference! You seem to use the term excel for both.
In order to help you further explain in detail how you want to see the data:
A: In the csv file as it grown
B: when you export the graph to excel.
So far you just peppered us with a litany of pictures without really telling us what you want or don't want in each. Please be very specific! Thanks
04-11-2023 03:25 PM
I am sorry for the misunderstanding. I meant " I am missing Frequency (Hertz) - tank pressure". Yes, you are right, the frequency column is static across iterations. It shouldn't change.
This below is what I want to get:
Instead I get this below. when I tried to transpose and I only get one column (tank pressure)
04-11-2023 03:30 PM
Also Mr. Altenbach! I meant .CSV file. I use excel file and csv file interchangeably. I shouldn't. Sorry for all the misunderstanding. I need to start reading carefully my post before posting.
04-11-2023 04:38 PM - edited 04-11-2023 05:30 PM
We still don't know what you want.
Both problems are trivial to solve, but we need to know what you want, not what you have.
Assuming the frequency column is a linear ramp, you have all the information to create it from scratch (x0, dx, N).
04-11-2023 08:00 PM - edited 04-11-2023 08:53 PM
Hi Mr. Altenbach,
Your second question is exactly what I want to accomplish. You got it right there.
But in brief, here is what I want to accomplish:
I would like to replicate what "export data to excel " invoke node
can do using "writing to text file " , "tdms write " or "write delimited spreadsheet
To use export data to excel, I did this below:
In other word, if export data to excel" wasn't existing, how would you write your code so that the .csv file looks exactly like what "export data to excel" invoke node can generate?
Now how would you write the code without using "export data to excel" so that the data on .csv file looks exactly the same as what "export data to excel" invoke node can generate?
04-11-2023 09:20 PM
As I said create the x ramp and append both to the csv file in the correct orientation.
Your graph export only contains data from one iteration. I assume you want to append data to the csv file forever, right? I assume you want the frequency column to be a sawtooth, starting over with each iteration.
04-11-2023 10:22 PM - edited 04-11-2023 10:47 PM
Yes, exactly. It sounds like you know exactly what I am trying to achieve. But this screenshot is the one thing I can think of. Is this what you mean?
I don't know why this is being so hard. I can successfully generate the y-axis data, data on the x-axis is the only thing I am struggling with.
I will test this when I go to the lab tomorrow. I don't have any equipment with me.
04-12-2023 09:15 AM - edited 04-12-2023 09:19 AM
OK, lets' look at this:
You are creating a waveform with no Y values, a start time of zero and a dt=50, then you are using "variant to data" even though a a waveform is NOT a variant! to convert it to a single scalar DBL, then you convert it to a 1d array with one element which you then built into a 2D array with your data, but since it is much shorter (only one element), it will get padded with zeroes to match. There is no reason and logic to any of this! It's like a picture of a fish riding a bicycle! You can't just line up a cacophony of random functions and assume it is correct if the wires are not broken.
Here's is one way to create an x ramp from known dx and adding it as first column to the Y data. Y can be any size, of course. (Assuming x0=0, but it would be easy to have that as variable too).