LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how i can stop while loop with number completely?

Solved!
Go to solution

hi

my exact problem is that

 

i want to create matrix element by element.

for example i want to create matrix A that A(ij)=(i^2)+j

and B that B(ij)=i+(j*2)

 

and then want to crate new matrix(C) that elements is equal to c(ij)= tan( a(ij)/b(ij) ) 

 

thank you so much

 

0 Kudos
Message 11 of 15
(925 Views)

hamedi wrote:

my is problem that want to use each value in while loop, and fill a matrix with them.

i want to creat a 128*128 matrix that each element of it is depended to i and j.

and after the matrix is full i want to use it.


 

As a first step, you need to learn LabVIEW, especially the magic of dataflow. In your above code, you have to independent code parts: the loop on the left and the linear code on the right. Since there is no data dependency between the two, both will run in parallel when the VI starts. This means that the code on the right will read the default values of the two controls precess them as wired, and stop. The code on the left will pump data into the controls that will never be read again during the execution of the program.

 

SInce you know the number of iterations from the beginning, you need FOR loops, not while loops.

SInce the computations are fast, you don't need a delay in the loops. Delays are for interactive, UI polling loops. That entire matrix can be generated in nanoseconds.

 

Then you also need to figure out your math. For example your upper formula node outputs the same values at all times, independent of the "cont" input. Since the math is so screwed up on the diagram, can you give us the plain formula you want to use?

 

 

 

All clear?

0 Kudos
Message 12 of 15
(916 Views)
Solution
Accepted by topic author hamedi

hamedi wrote:

i want to create matrix element by element.

for example i want to create matrix A that A(ij)=(i^2)+j and B that B(ij)=i+(j*2)

 

and then want to crate new matrix(C) that elements is equal to c(ij)= tan( a(ij)/b(ij) )  


What do you mean by "element by element"? You just want the 3 matrices, right? How they are made should be irrelevant 😉

 

Here's a literal implementation. Depending on your definition of row/colum vs i/j you might need to swap a few things if needed. In LabVIEW, the lowest index is 0, but I assume you want to start with i=j=1 for the first element (else you get a division by zero), thus the "+1" primitive.

 

(I also assume you don't have a typo and one is squared and the other mutiplied by two).

 

 

 

Message 13 of 15
(904 Views)

my dear altenbach thank you for solve my problem.

 

it's solvedSmiley Very Happy

 

how can i gratitude you?

 

 

0 Kudos
Message 14 of 15
(888 Views)

@hamedi wrote:

my dear altenbach thank you for solve my problem.

 

it's solvedSmiley Very Happy

 

how can i gratitude you?

 

 


Just click on the star.......He works for "Kudos"  "options" Accept as solution would be sweet too!

Nice save Christian!


"Should be" isn't "Is" -Jay
Message 15 of 15
(863 Views)