LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MATLAB script Node

Hi,

 

I have been trying to create a user interface where the user enters values for variables. These variables are then transferred into a MATLAB Script Node and the Matlab Script creates 4 XY plots and is meant to display them in one XY graph, however an error appears and I am not sure what it means as I am a complete novice in Labview. The MATLAB Scripts works perfectly on MATLAB.

 

Can someone please help me correct my file?

 

 

0 Kudos
Message 1 of 8
(1,936 Views)

Can you "save for previous". many don't have LabVIEW 2021 yet.

 

Not sure why you would need Matlab script to create data for a graph? Seems like a crazy detour!

0 Kudos
Message 2 of 8
(1,913 Views)

Because the plots calculated are solved by differential equations and we’re easier to plot on Matlab which I have experience using. Also, as I said, I am a complete novice to LabVIEW so I didn’t know how to approach this.

0 Kudos
Message 3 of 8
(1,895 Views)
0 Kudos
Message 4 of 8
(1,888 Views)

What is the error you are getting? What the error code? (I am only getting a Matlab error because I don't have Matlab on the current computer). Also, a proper UI probably needs a toplevel loop with a defined rate.

 

(Obviously, there are some glaring inconsistencies with datatypes. Why are some of the inputs defined as complex datatype? (look for the red coercion dots). I have a hard time imagining what e.g. a complex temperature would mean. 😄 )

0 Kudos
Message 5 of 8
(1,884 Views)

Error 1050. 

What should the data types be? I don’t know what the differences are.

0 Kudos
Message 6 of 8
(1,880 Views)

I have worked out one error - in the bottom Matlab script. Clearly these won't work in Matlab either.

You have this Matlab Code:

 

a = zeros(73,1) ;
b = zeros(73,1) ;
x = zeros(73,1);
z = zeros(73,1) ;
Y(:,1) = a;
Y(:,2) = x;
Y(:,3) = b;
Y(:,4) = z;

 

The last 4 assignments are reversed (and are causing one of the errors.

I would suggest trying these out again in Matlab, supplying the necessary parameters. Unfortunately we do not get told where the error is inside the Matlab script, only that there is an error.

0 Kudos
Message 7 of 8
(1,868 Views)

All your errors are Matlab script related and come from Matlab, not LabVIEW:

 

  • Unable to perform assignment because the size of the left side is 41-by-1 and the size of the right side is 73-by-1.
  • Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses. (twice)
  • All your inputs seem to be "real", so right-click the inputs with the red dots and "Chose data type...real" (the red dot might not disappear until later, e.g. the next run attempt.)
0 Kudos
Message 8 of 8
(1,861 Views)