07-06-2013 12:02 PM
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
07-06-2013 01:24 PM - edited 07-06-2013 01:36 PM
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?
07-06-2013 02:02 PM - edited 07-06-2013 02:04 PM
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).
07-06-2013 03:57 PM
my dear altenbach thank you for solve my problem.
it's solved
how can i gratitude you?
07-07-2013 07:27 PM
@hamedi wrote:
my dear altenbach thank you for solve my problem.
it's solved
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!