LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating matrix - Mathscript or Formula Node?

Hi everybody

I'm looking for the best way to define a matrix in Labview.
Which way is the best (easiest/clearest/fastest)?
It looks like formula node is faster than mathscritp node, but it looks quite cumbersome to define a 6x6 matrix doing this way:

float K [6][6];
K[0][0]=m*L;
K[0][1]=....
K[1][1]=.....


for example, i need to define this matrix:

% KL = [ E*A/L,           0,             0,     -E*A/L,           0,          0;
%            0,  12*E*J/L^3,     6*E*J/L^2,          0, -12*E*J/L^3,  6*E*J/L^2;
%            0,   6*E*J/L^2,       4*E*J/L,          0,  -6*E*J/L^2,    2*E*J/L;
%       -E*A/L,           0,             0,      E*A*L,           0,          0;
%            0, -12*E*J/L^3,    -6*E*J/L^2,          0,  12*E*J/L^3, -6*E*J/L^2;
%            0,   6*E*J/L^2,       2*E*J/L,          0,  -6*E*J/L^2,    4*E*J/L;];


Thanks a lot
0 Kudos
Message 1 of 2
(8,897 Views)
Hello,

There is not really a clear answer for the best method to create a matrix; it depends on your situation.  The easiest method to create and maintain a matrix and the clearest to understand is to use the MathScript node.  However, the fastest method from an execution point of view is to use the formula node or pure LabVIEW primitives.  A 6x6 matrix doesn't take much time with any method, but if you are going to be using larger matrices, that may influence the decision.  Also, since you parameterized the matrix, perhaps you need to recompute it often (e.g. in a loop).  If so, you may want to use either the formula node or pure LabVIEW.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 2 of 2
(8,814 Views)