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-16-2012 12:28 PM
Hi there,
I have the following matlab script, whereby I am trying to input it into labview without using the MathScript or Matlab Script nodes. Do you have any idea how??
----- I understand that below 3D matrices don't exist in LabView so I attempted to use a index array and initialize array functions.
% Build empty u, v, b matrices
u=zeros(length(x), length(y), length(t));
v=zeros(length(x), length(y), length(t));
b=zeros(length(x), length(y));
h=zeros(length(x), length(y), length(t));
% Define initial condition
h(:,:,1)=ones(length(x),length(y),1)*4000;
for j=1:length(y)
for I=1:length(x)
if x(I)<600000&x(I)>500000
h(I,:,1)=4000-3*sqrt(3)/2*H*sech(k*(x-500000)).^2.*tanh(k*(x-500000));
end
end
end
Many Thanks
04-16-2012 12:56 PM - edited 04-16-2012 12:57 PM
Initialize array (resized for three indices, except for "b", which is 2D) is the correct tool to create the 3D arrays. To fill them with data, use "replace array subset". Possibly in a loop if needed.
See how far you get.
04-17-2012 09:31 AM
Hi, I attempted it as you said, however I am a little unsure as how to wire the values of the 'replace array subset' with the 'Initialize array'.
I'm sorry my attempt is a little pathetic but I have no knowledge of labVIEW what's so ever. please find it attached.
Thank you very much
salma
04-17-2012 09:40 AM
I am curious what possesed you to make all three dimensions "infinite". You are guaranteed to run of of memory (inf coerces to 2^31), so you are actually trying to allocate 9,903,520,314,283,042,199,192,993,792 bytes! 😮
As I said, the 3D array need to go in a shift regsiter of a loop where you replace the calculated values for the desired elements.
04-17-2012 09:54 AM
OK so if I place the values through a shift register would that mean that I can only access one value at a time? The reason I need to be able to access all values is because im initializing the array to store values for a 3d graph. Would I still be able to do so?
04-17-2012 10:51 AM