09-10-2014 04:03 AM
Hi there
I'm using a Labview with some matlab code, and every time I add decimal digits to certain values I get an error 1047. Here is the code:
format long c1_0 = 0.00025 % [m] Starting distance of capacitor 1 to ball surface c2_0 = 0.00025 % [m] Starting distance of capacitor 2 to ball surface c3_0 = 0.00025 % [m] Starting distance of capacitor 3 to ball surface T = 20 % [deg C] curent temperature % Calibration variables - [V] measured at 0 and 0.3 mm V1_min = 3.7 V1_max = 8.8 V2_min = 3.7 V2_max = 8.8 V3_min = 3.7 V3_max = 8.8 Meas_mm = 0.3 % Measuring range of the sensor in [mm] % Sorting out Temperature effects - assuming linear expansion due to T T0 = 20 % [deg C] reference temperature RdT = (T - T0)*(1.6250e-6/5) % expansion of radius CdT = (T - T0)*(1.6411e-6/5) % displacement of sensor tip R = 0.025 + RdT; % [m] Mean Radius, converted from [mm] to [m] c1 = (-(Meas_mm*V1_min)/(V1_max - V1_min) + (Meas_mm)/(V1_max - V1_min)*V_c1)/1000 % [m] Measured capacitive displacement of sensor 1 c2 = (-(Meas_mm*V2_min)/(V2_max - V2_min) + (Meas_mm)/(V2_max - V2_min)*V_c2)/1000 % [m] Measured capacitive displacement of sensor 2 c3 = (-(Meas_mm*V3_min)/(V3_max - V3_min) + (Meas_mm)/(V3_max - V3_min)*V_c3)/1000 % [m] Measured capacitive displacement of sensor 3 x1 = R + c1_0 + CdT % [m] x1 position y2 = R + c2_0 + CdT % [m] y2 position z3 = R + c3_0 + CdT % [m] z3 position % Solve for the x, y and z coordinates of the centre of the ball syms x y z F1 = (x1 - x)^2 + y^2 + z^2 - (R + c1)^2 F2 = x^2 + (y2 - y)^2 + z^2 - (R + c2)^2 F3 = x^2 + y^2 + (z3 - z)^2 - (R + c3)^2 S = solve(F1, F2, F3, x, y, z) % These results are the change in the centre of the ball relative to its % mathematical centre resting place in X, Y and Z coordinates. x = double(S.x(2)) y = double(S.y(2)) z = double(S.z(2))
If I change the values of, say, V1_min to 3.175 or V1_max to 8.88 (adding more decimal places) I get a 1047 error. The code as it currently stands works perfectly - no errors. Running the code with any number of decimal places in matlab itself returns no errors - Labview seems to create the issue.
Any help please?
09-11-2014 11:50 AM
Unfortunately since this script is executed with an ActiveX Server outside of LabVIEW I don't have the software to reproduce your error.
You're going to have to try several different configurations to isolate what could be causing this. Here's some guiding questions to isolate this:
Once we can isolate this further it's usually pretty easy to identify a workaround to avoid the error!
Here's some related documentation:
http://digital.ni.com/public.nsf/allkb/8BEBC0C86541224286257AF300561B5E
http://digital.ni.com/public.nsf/allkb/2B3FF46C8512C4F786256CF30071BE53
09-15-2014 06:49 AM
Hi Craig
I've experimented with various things, and the most prefereable setup I've come across is to have the script split up across three matlab script nodes - this seems to work.
When using one node, there are anomalies such as if I end a line of code with a ";" or not (suppressing matlab output) then I get an error. I find this strange. getting rid of the "format long" line also cleared it up a bit.
Thanks for the help. I still dont know why the error happens, but it seems to work for now.
09-16-2014 03:09 PM
I'm glad to hear you got it working!