LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph

Hello.
As you can see from the attached images, I have to build a graph that has the elements of the first column of the table in the axis of x and those of the last column in the y axis.
I think there is a problem with the shape of the elements of the first column.
How can I fix the problem?
Thanks

Download All
0 Kudos
Message 1 of 46
(3,873 Views)

Hi gmazza,

 

maybe you should define your algorithm before trying to program it?

 

- you convert the first and 11th column of your table to number. Everything is fine until now (with some Rube-Goldberg overhead)

- you get a 1D array of xy-clusters after the first loop

- now you create a 2D array of clusters just to reshape it back to a 1D array. What's the purpose of that step?

- you reshape to a 1D array of just one element. What's the purpose of that step?

- you sort the resulting array (which contains just one element). What's the purpose of that step?

- you unbundle the cluster to form 1D arrays of x- and y-values. Why don't you create those arrays in the first loop?

- now you create a plot for the graph. That's fine - but that plot contains just one point as explained above...

 

What's the "shape of the elements of the first column"? Why do you think you have a problem there?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 46
(3,832 Views)

Ok.
You're right. The second part of the code is not needed. Takes only the first cycle, the "build array" function and the "reshape" function.
I think there is a problem in "format string" input of the "scan from string" function. Do not you think?

0 Kudos
Message 3 of 46
(3,824 Views)

Hi gmazza,

 

you didn't answer all my questions...

 

How should I know about ScanFromString when I don't know the strings in the first column of your table?

When there is a problem you will get an error message from ScanFromString...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 46
(3,821 Views)

I'm sorry. I did not realize that the table elements were missing.
I attach the new image. The other image shows the error that "scan from string" function returns.

I hope it is clear.

Thanks

Download All
0 Kudos
Message 5 of 46
(3,808 Views)

What is the "format string" of:

SART 01

?

Thanks

0 Kudos
Message 6 of 46
(3,768 Views)

Please stop attaching useless pictures and attach the actual VI instead!!!

 

Looking at the images, most of your code makes no sense at all. What's the purpose of the "build array...reshape array to 1 element" construct? Makes absolutely no sense! Why is there no format string defined?

 

Your use of local variables also could lead to race conditions. What if the local variable is read in the bottom left before other parts of the code had a chance to write to it?

 

Please run your VI until all controls/indicators contain data. Now go to "edit...make current values default". Save under a new name and attach the VI here.

 

WIth the current information, we cannot help.

0 Kudos
Message 7 of 46
(3,760 Views)

Sorry but I can not attach the VI (otherwise I would have done).
The Local viariable refers to the table from which I extract the elements for the chart.
What I do is: Using the for loop to extract the elements of the first and last column of the table (using Index Array). Finally via "Bundle" function I would like to create the chart.
The program tells me an inconsistency between what comes out of the loop and the chart type. It also noted that there is a problem in the input "String Form"of "Scan from string" function ( String form should be reportedly to SART 01 .. 02 .. 03 etc, so it should include both the code for the string and for the number )  
Sorry again if I do not attach the VI but I can not do it (I do not know why).

Thanks

Download All
0 Kudos
Message 8 of 46
(3,745 Views)

Try ZIPping your file.  Some people have had trouble attaching VIs but can attach ZIP files.

 

The XY Graph accepts an array of clusters - but the cluster must be a special type representing a point. The cluster must contain exactly two numeric scalars, representing the x and y values of the point, respectively.  In your image you are creating a cluster with a string and a numeric.

 

How do you get x and y values from your SART 01 .. 02 .. 03 string?

 

Lynn

0 Kudos
Message 9 of 46
(3,739 Views)

I want SART 01, SART 02 etc ... are in the x-axis, whereas the numbers of the last column are on the y axis. 

0 Kudos
Message 10 of 46
(3,714 Views)