From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-17-2009 10:34 AM
Hi,
Can the Mathscript feature in Labview 8.5.1 handle 3D arrays and process the data accordingly? All of the arrays are generated within the Matlab script, analysed and processed as required and individual 1D numbers outputted back to Labview.
Thanks.
Solved! Go to Solution.
04-17-2009 02:48 PM
04-17-2009 04:18 PM
Grant,
Thanks for the reply. I can accomplish the same tasks in 2D arrays but this doesn't make the code as efficient and obviously now requires multiple variables. It would be useful if LabVIEW and Mathscript could accommodate 3D arrays in the future.
04-18-2009 11:48 AM - edited 04-18-2009 11:50 AM
On the subject of arrays, I've found another glitch in Labview's Mathscript, when compared to Matlab's operation. I'm not sure if this has already been reported, is known or has been fixed in LV8.6, so sorry if it's a duplicate report!
Say you have the following script in Matlab:
for n = 1:1:10
x = n^2;
y = x^2;
data_array(n,: ) = [n x y]; %Space added between : and ) because the forum turns that into a smilie!
end
This works fine and generates a lovely 10x3 array, which gets progressively bigger with each iteration of the loop.
However, Labview generates the following error when running this: "Error in fuction '-' at line 4. The number of ruws and columns that the indexes specify must equal the number of rows and columns of values you want to set". The only way around this is to code the script as follows (or at least the only way I've found):
for n = 1:1:10
x = n^2;
y = x^2;
data_array(n,1) = n;
data_array(n,2) = x;
data_array(n,3) = y;
end
This obviously isn't overly efficient when you have ten or more columns, and then run the array-build through an IF loop to change the contents on certain conditions! Can anyone think of a better way of doing this that uses less lines of code?
Cheers 🙂
04-20-2009 08:58 AM
Hello,
> It would be useful if LabVIEW and Mathscript could accommodate 3D arrays in the future.
LabVIEW can absolutely handle 3D (and higher) arrays. It is only MathScript that cannot.
As for the other error you mention, I can't reproduce it in 8.5, so perhaps it is specific to 8.5.1. It also seems to work properly in 8.6.
Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
07-29-2013 12:55 AM
lol you cant use 2D arrays to represent point clouds ie (x,y,z) .... I want to manipulate pointclouds in a mathscript node
07-29-2013 02:13 AM
@Sentinal_Bais wrote:
lol you cant use 2D arrays to represent point clouds ie (x,y,z) .... I want to manipulate pointclouds in a mathscript node
Then this is something for the ideas exchange where new feautures can be proposed. It seems there already is an idea along these lines, and it did not get much support so far. Only 11 votes since January 2011.
I think it is easier to implement the algorithm in plain LabVIEW anyway. What do you need to do with these point clouds?