04-16-2017 07:48 PM
Hello Forum Users,
I have attached two data files (rows need to be transposed to columns). They both have a common X column while the Y is variable so if the arrays are transposed the columns should look like this (X,Y1,X,Y2,X,Y3,....).
My files are much much larger I attached only the first twenty columns.
I have also attached the basic VI I worked with the help of some posted materials in here and Larsen's book. It is not showing me what I wanted so I needed help in that please.
What I am trying to do is read each file, transpose it, pick every Y column only and gather them in new array (neglect the common repeated X for now). Then divide each column in file 1 by the same column in file 2 and generate a NEW array. Feed X column values and this NEW array to an intensity graph to show the generated plot.
I needed also to assign values to Y axis (for now -4 to 5 in steps of 1). I didn't know how to do that? Any help and advice is appreciated.Thank You
04-16-2017 09:15 PM
Dear Sama,
Firstly, thank you for a nicely arranged VI with comments highlighting the parts you had difficulty with. This made it much easier to understand what you wanted (although I'm still missing a bit at the end) and compare it to your forum post.
My understanding is that if you add a '1' numeric constant to your index functions (after the 'Array Size' node) and then add an 'Increment' function after the multiply inside your For loops, you'll get the output you want from the three loops (make no changes in the divide loop - that's already fine).
Unfortunately, I'm not quite sure what you want to see in the Intensity graph. Do you want the result of the division to be the Z value, or intensity? And if so, what are your Y values? I'm guessing you want the X values for your grid to be the repeated columns that you've placed in the top of the Build Array node?
04-17-2017 01:45 PM
Hello @cbutcher, Thanks a ton for the suggestions, I appreciate your help, here is the current status and the answers to your questions, sorry I don't get totally clear in expressing sometimes:
1. I tried all you suggested highlighted the execution and followed it. I had to get rid of the numeric (1), kept the incrementing (thank you) and changed the Boolean from True to False in the initial read spreadsheet function as it was not transposed originally.
It outputs exactly what I calculate in any other software (if you extract the data from the graph after running it is identical to what I would calculate with Matlab, yay).
2. The output is correct now and fine it just doesn't produce a correct intensity graph. It just shows a single line. I shifted to intensity chart and still the same.
3. What I meant in the last part will be much clearer for you in the "Intensity Example" picture. Your assumption was correct ,the processed array values are Z's , the single first common row I picked up was X, and I have 10 columns after processing the new array so I wanted to set values for Y-axis (-4,-3,...,5) instead of having arbitrarily numbered for me from 1 to 10. That's what I meant.
I think the way I am feeding the data is correct to the intensity graph why is it not displaying it the way it should? And how do I assign the values or column numbers to the Y-axis?
04-17-2017 10:11 PM
Would a 3D surface graph (with xy view) be a better choice rather than an intensity chart in this case?
04-17-2017 10:23 PM
I wouldn't swear to it, but I think with the Intensity Graph, you're stuck with array indices as your (raw) scales. In your Y case, if you know the range you want to map to, you can calculate a multiplier and offset, and use a property node to set those - you have 2000 points and want them to be from -4 to 5, so you need an offset of -4, and a multiplier of 0.0045.
I haven't been able to find a way to arbitrarily change the x axis to a set of values. In the data you sent, it seems like you have an almost constant step size, so maybe you can do the same as with the X axis - I don't know if that's suitable for your data or not. By my guess, you'd need an offset of (Index Array - 0th element) and a multiplier of 1/(Index Array (1st) - Index Array (0th)).
04-18-2017 08:10 PM
Thank you @cbutcher for getting back to me I haven't had time to work on the vi since last night but I will do so tomorrow and will let you know. A few old forum topics for 2D plotting seem interesting to try.
Thank you
04-18-2017 09:10 PM
Fantastic! Maybe you can provide links in this thread so that other interested readers can take a look at which posts you mean. Good luck with your plotting. I also took a look at the surface graph but didn't see an obvious way to make it do what you wanted exactly. It's probably possible (most things are) but I couldn't work it out.
04-19-2017 10:37 PM
Hello all,
Dear @cbutcher, I really appreciate your help and replies, it is ok thank you so much.
So I processed correctly the Y-axis data and I can read a 1D array with 10 elements in the range (-4 to 5) starting by reading the size of the "divided" z-array.I generalized it to suit my large and variable size data sets without me having to input fixed multiplier/min/max everytime. I really laughed at myself after over 5 hours of trials and error when I saw the correct numbers outputted at the array indicator. The idea is simple the execution for me wasn't trivial being a newbie, I am sure LabVIEW and I will be lifetime friends eventually "well as long as I can maintain a license after graduation", I just have to invest more time in it.
Also plotting in 3D and feeding X,Y,Z was way direct than I thought and easy but the final image is coarse and ugly (attached) but that's for me now to work on.
As for the related forum links; they are quite old but really pretty.
(if anyone want to look beyond those just google 2D or 3D graphs LabVIEW forums).
http://forums.ni.com/t5/LabVIEW/How-to-plot-3D-surface-graph-from-X-Y-Z-points/td-p/1193853
https://forums.ni.com/t5/LabVIEW/3D-parametric-surface-plot/td-p/2293962
My only issue currently in the vi is producing a correct intensity graph. 3D graphing was quick I can do with it and call it solved for now but I really wanted to know how to feed the correct array to the intensity graph. It seems to work with Z-2D array data only and throws their cell positions as x & y data and not their actual x&y data. What about my X-1D array and Y-1D array? Any hint on appropriately creating a unified array somehow or a starting point would be very much appreciated. If I fed X & Y data by build array function it seems to read them as also z data and changes the Intensity scale accordinglly. Autoscaled on and off and still struggling.
Thank you,
04-20-2017 09:19 AM
After skimming through almost all previous posts about setting the actual xy data for intensity graphs the conclusions are:
1. Many needed to do that with just a simple intensity graph like what we are used to with conventional plotting softwares (Matlab, OriginLab,..).Unfortunately, one won't be able to tell who are the parents of Mary and who are the parents of Jane all they will know is their age.
2. @cbutcher was correct, I am stuck with their row & column position in the array.
Thank you,