LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A basic problem with SubVI

Hi,
I have a basic problem with Subvi.
 
My question is:
Can I decide which are the input and output of a subVI?
 
In the attachment, I have shown my problem with comments.
 
Open the attachment with order.
 
Thank you.
 
Matteo
Download All
0 Kudos
Message 1 of 14
(3,897 Views)

Yes you can.

After the creation of a VI from some selected code inside your caling VI you can open the VI and edit it. For savety reasons save it first to hard disk and give it a reasonable name. After that click right on the front panel icon of the VI and select show connector. Switch the tool to something else than the selection tool. If you click on one of the connector inputs the corresponding control or indicator will be selected. By a right click on the connector you can select another pattern or to disconnect one or all inputs. With this you can rearange the VIs inputs and outputs.

When you have done all changes than save again. The calles VI in your top level VI will be grayed out. Just click right on the VI and select RELINK TO SUBVI.

Thats it.

With kind regards

    Martin

With kind regards

Martin Kunze

KDI Digital Instrumentation.com
e-mail: martin.kunze@digital-instrumentation.com
Tel: +49 (0)441 9490852
Message 2 of 14
(3,882 Views)
Controls on the subVI are inputs, indicators are outputs. the index should be an input, thus you need to change it into a control in the subVI.
 
It is not clear what your program is supposed to do, it seems flawed.
  1. You run the loop for each element in the array diagram constant, yet this will only make sense if index is zero at the beginning. In all other cases, you'll index some array elements that don't exist.
  2. If Index should always start at zero, it does not need to be an input. In fact, you could even use autoindexing or operate on the array directly (no FOR loop), depending on the desired functionality.
  3. You make 8 comparisons, but only the result of the very last comparison is returned from the subVI, all other results are overwritten. A waste of CPU resources.
  4. What should the output be? Should it be true if at least one element is greater than five? Should it be true only if ALL elements are greter than five?
  5. It does not make much sense to call a subVI where all interesting values are diagram constants. Don't you want the array and comparison value also to be inputs?
  6. Drop the stacked sequence and all local variables. Use a shift register instead.
  7. Can you explain why you don't want to use the index terminal?
  8. Can you explain the purpose of this subVI? It does not make sense.

Attached is a "literal" translation of your subVI. It does not make much functional or logical sense, but it shows how you would make "index" a control and use a shift register to increment it.

Please explain the purpose and intended functionality. Maybe we can come up with a better solution. 🙂

Message 3 of 14
(3,866 Views)
Thanks at all for answering.
 
Now, to Altenbach.
 
Thank you for all your tips. But the problem is unsolve.
 
It isn't important what my program do. The problem is when I create Subvi.
 Now I attach "temp.vi", the subvi of problem_variable (to bloque).vi.
You can see , the jam, the mess that produces.
 
Is true that...
Every time I built a subvi, in a block with Local Variable, Labview produces reference.
In this procedure Labview , create mistake, in subvi---> A correct sub Vi becomes a incorrect sub VI
 
Thank you
0 Kudos
Message 4 of 14
(3,841 Views)

kurt_come a écrit:
It isn't important what my program do. The problem is when I create Subvi.
 Now I attach "temp.vi", the subvi of problem_variable (to bloque).vi.
You can see , the jam, the mess that produces.
Is true that...
Every time I built a subvi, in a block with Local Variable, Labview produces reference.
In this procedure Labview , create mistake, in subvi---> A correct sub Vi becomes a incorrect sub VI

You are right, it's a mess... but that's not a problem with LV ;):)

You can't create a subvi with imbedded local variables without automatc creation of corresponding control and a reference to it. Use global instead if you really need suche a solution.

May be you should listen more carefully to what Altenbach told you. That should make your life happier...

"Il n'y a pire sourd que celui qui ne veut entendre..."

 

Message Edité par chilly charly le 11-14-2005 01:32 PM

Chilly Charly    (aka CC)
Message 5 of 14
(3,837 Views)

chillly charly said:

You are right, it's a mess... but that's not a problem with LV 

You can't create a subvi with imbedded local variables without automatc creation of corresponding control and a reference to it. Use global instead if you really need suche a solution.

May be you should listen more carefully to what Altenbach told you. That should make your life happier...

"Il n'y a pire sourd que celui qui ne veut entendre..."


 
Hi,
chilly charlie.
 
I'm sorry, but I don't speak english.
 
This is a forum, and you seem a teacher, with a bad boy.
In my experience, I've never seen senteces like the last two in a forum.
I want you cancel the last sentences, of your post, else I will call with web master.
 
Thanks ,
Matteo Ferrari
 
 
 
 
0 Kudos
Message 6 of 14
(3,818 Views)
Call anyone you want but that won't get your problem fixed. You can fix your problem by doing what the experts tell you to do. There was no reason to use a local variable in the first place and making a subVI with a local variable makes even less sense.  
Message 7 of 14
(3,797 Views)


kurt_come a écrit:
chillly charly said:
...That should make your life happier... "Il n'y a pire sourd que celui qui ne veut entendre..."
This is a forum, and you seem a teacher, with a bad boy.
In my experience, I've never seen senteces like the last two in a forum.
I want you cancel the last sentences, of your post, else I will call with web master.


Sorry if you have been disturbed by my contribution. Relax, there is nothing to be cancelled. There was no offense, may be just a problem of serial translation from french to english, and english to italian I guess ?

You are right, I'm a teacher, really... even a University professor. And I also have some experience of helping others in this forum, as you may discover if you decide to stay with us. So I'll do my best to make things clear :
"That should make your life happier" means that if you listen to the guidance of the experts (... and Altenbach is undoubtedly one of out greatest experts ! He surely didn't deserve the poor rating that you gave to his excellent answer), you will meet less problems.
The second sentence "Il n'y a pire sourd que celui qui ne veut entendre" is a very old french proverb. Means that the worst deaf is the one that don't want to listen. (I thought you were either french or able to read french). In the context of this thread, it means simply that instead of sticking to your own idea, you should consider the point of view of others. That's why you came to this forum, am'I wrong ?

That being said, try to navigate through this forum, take the time to read a few threads, for instance in the BreakPoint board, and you will discover that this is not only a technical forum, but a space of friendship and humour. People here share the same passion and give freely hundred of hours of their life to help others.

So... since you are a newbie, ...listen and smile 🙂

 

 

 

Chilly Charly    (aka CC)
Message 8 of 14
(3,670 Views)

Are you chilly charlie?

NO

Message Edited by kurt_come on 11-15-2005 03:16 AM

0 Kudos
Message 9 of 14
(3,731 Views)
??????
Chilly Charly    (aka CC)
0 Kudos
Message 10 of 14
(3,725 Views)