LabVIEW

cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

shift register overwrite graph

Solved!
Go to solution

hi, i have problem with my program. when i want to compare legend graph with my present graph it just overwirite with my present graph.when I add new data then execute my program  it doesn't work. i was trying use shift regoster but my program eror. where i should put shift register in my program ? thanksgraph.PNG

0 Kudos
Message 1 of 9
(4,889 Views)

If you want advice about your program, don't show such a small piece that nobody can really help you.

0 Kudos
Message 2 of 9
(4,884 Views)

i'm sory., thos is my program

0 Kudos
Message 3 of 9
(4,873 Views)

You have two data files that you want to read, one when you push the Start button, the other when you push OK Button 2 (note that it doesn't matter in which order you push the buttons).  You have a graph that will display 2 traces, with one trace "loaded" from Input Data, the other loaded from Input Data 2.

 

Ask yourself what varies, and what stays constant.  One answer, it seems to me, is the trace -- initially both traces are 0 (or empty arrays), and when each button is pushed, one of the two traces is made from the Input Data, calculations of eigenvalues and vectors, and some final manipulations that you now are doing outside the Event loop (why?  bring it inside with the rest of the calculations).  Seen in this light, you need two Shift Registers, one that holds Trace 1, the other that holds Trace 2, both initialized outside the While loop with empty traces, and both combined with Build Array just before displaying the graph.

 

A note on Front Panel Boolean Controls and Event Structures.  Your Boolean controls are all set with Latch when Released to act as "momentary push buttons", i.e. once you let go of the mouse, they "pop up" again.  For this to work, they need to be read.  The usual way to do this is to put the switch inside the Event case that it controls, usually wired to nothing.  You know what its value has to be (True, since once you read it inside the Event, it will "pop back" to False), after all ...

 

Bob Schor

0 Kudos
Message 4 of 9
(4,853 Views)

I have edited my program . but  I still can not to display two graphs .i'm still confuse with " you need two Shift Registers, one that holds Trace 1, the other that holds Trace 2, both initialized outside the While loop with empty traces, and both combined with Build Array just before displaying the graph." cause i try both the graph didn't change anything. perhaps you could edit my program ?Smiley Very Happy

0 Kudos
Message 5 of 9
(4,837 Views)

First of all, your code does not contain a single shift regsiter. Show us what you tried..

 

I would strongly recommend to first do a few LabVIEW tutorials.

  • There is way too much duplicate code. You have two copies of basically identical code, only differing in the trigger button, path, and output selection. Only once instance of the bulk of the code needed. Read the path and redirect the output based on the boolean.
  • You have way too many FOR loops. The third FOR loop can be deleted without change in functionality.
  • The sequence structure has no purpose, delete it!
  • You can combine the first two FOR loops into one.
  • You don't need to wire N when autoindexing, except for the first for loop, but only in case you want to use fewer elements/rows than contained in the autoindexing array.
  • The terminal of latching booleans belong inside their repsective event cases
  • Don't float terminals over structures. Very bad.
  • Use reasonable names for controls and indicators to make the program readable.

 

 

0 Kudos
Message 6 of 9
(4,815 Views)

thanks for your correction, i'm newbie in labview program. sory if my program looks so bad. i have edited my program with shift register, but it still not show legend graph with difference color. what next should i do ?

0 Kudos
Message 7 of 9
(4,778 Views)
Solution
Accepted by topic author bimooo

The shift register belongs on the outer while loop. There is no need for the inner while loops. The shift register should contain an array of two xy plots. Replace one of the two plots accrding to the button pressed using "replace array subset".

You only need a single shift register, You still have way too much code.

 

(Please attach VIs with a suitable name. My donwloads folder already contains dozends of "untitled  x.vi" files)

0 Kudos
Message 8 of 9
(4,725 Views)
Solution
Accepted by topic author bimooo

I absolutely agree with Altenbach that you need to learn more LabVIEW, and think more about Design and Style.  I endorse taking the on-line tutorials, paying particular attention to the form and format of the examples that they illustrate.  Try to emulate their simplicity.

 

However, in an effort to get you on the right track, here is what I was trying to get you to do in my earlier post.Eigens.png

The Event structure is contained within a While Loop that builds and displays the Graph.  The job of the Event structure is (among other things) to generate the data for the First Plot or for the Second Plot when a button is pushed.  The data are carried on the two shift registers shown here, and are combined to make the plot.  They are initialized to empty arrays outside the loop.  Notice that the Boolean Control that "controls" the Event is located inside the Event loop -- when you take the Tutorial that covers Event structures, you will learn why this is done (I also mentioned this in my previous post).

 

Altenbach is right -- you do not need two Shift registers, as you could do the Array build/updates inside the Event.  "You Pays Your Money and You Takes Your Choice" -- I thought doing it this way was easier to state, and hoped that you would "get it" more quickly.

 

Bob Schor

 

0 Kudos
Message 9 of 9
(4,707 Views)