LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Type Nonsense with xy plot

Hi everyone, this problem might be trivial to most of you, but I was just not able to solve it in any way shape or form... I consolidated with ChatGPT, it could not help me either.

I used LabVIEW to read from a .txt File and I extracted data I needed. My goal is to plot the data, but LabVIEW constantly complains that my "source" data type does not match the "sink" data type.
The "sink" is 1D Array of Cluster of 2 Elements. That is the exact data type of the "source", but LabVIEW complains nontheless. Both "phase angle" and "time" are 1x200 structures without any further unwanted input. I literally have no idea how to make this very simple request work.

Help is appreciated,

Thanks!

0 Kudos
Message 1 of 7
(243 Views)

Addressing *only* the datatype issue...

The datatype of your source is *actually*: 1D Array of Cluster of 2 Arrays of N Elements

 

Supposing your 2 arrays have the same length, auto-index them through a For Loop where you build a cluster from individual array elements.  Then auto-index that cluster into an output 1D array.  See below:

 

image.png

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 7
(231 Views)

Hi KL/Kevin,

 

you can replace the FOR loop by Index&BundleClusterArray with 2 inputs…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 7
(195 Views)

There are so many things wrong with your code that I would recommend a few basic tutorials.*

 

You are NOT using an xy graph, but wire to the plotXY subVI which requires a picture indicator (missing!) as output and only accepts a single type of xy data (an array of points). I would strongly recommend to use an xy graph, which would accept your data (and much more!). 

 

*footnote:

  • Do you really think it is reasonable to read the same file and do exactly the same processing millions of times per second (or until an array has the same size as the iteration count)?
  • Why read the same file twice in parallel and do some very convoluted duplicate processing to get the data jumping from array to string and back to array, etc.?
  • Can you attach a typical datafile and explain how the data is arranged and how you want to plot it?
  • I am sure the entire thing could be done with code that fits on a postage stamp!
  • Why is the phase angle derived from a timestamp while the time is just a DBL? 
0 Kudos
Message 4 of 7
(193 Views)

@GerdW wrote:

you can replace the FOR loop by Index&BundleClusterArray with 2 inputs…


D'oh!   Good call.   (I forgot there even is such a function, I don't think I've ever used it.)

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 5 of 7
(154 Views)

I did not ask you to comment on the overall quality of my code. Please be professional

0 Kudos
Message 6 of 7
(46 Views)

Hi KLS,

 


@KLS93 wrote:

I did not ask you to comment on the overall quality of my code. Please be professional


So we aren't professional because we comment on the quality of your code?

You're the one who wrote:


@KLS93 wrote:

I literally have no idea how to make this very simple request work.


To become "more professional" you might think about:

  • attaching code instead of images of code. (We cannot debug/edit/run images in LabVIEW!)
  • use AutoCleanup as long as it improves your code. (Bugs can hide less in clean code!)
  • the meaning of "cluster of 2 elements", when "elements" aren't specified with more details.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(38 Views)