LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Mathscipt and for loop

Solved!
Go to solution

I have a code in Mathscript/matlab and I need to output the array out. One option is my first code,the other option is using a for loop, but I am only getting the last ouput out. I need to get the whole output out.

 

 

 

Any help.

 

Thanks

0 Kudos
Message 1 of 7
(3,357 Views)

Right-click the mathscript output terminal and "choose data type...1D array...DBL".

RIght-click the output tunnel of the FOR loop and "enable indexing".

 

 

0 Kudos
Message 2 of 7
(3,355 Views)
Solution
Accepted by topic author ade77

Here's how it should look like.

 

Message Edited by altenbach on 10-30-2008 05:12 PM
0 Kudos
Message 3 of 7
(3,354 Views)

If you want to use your option 1, use the code in the attached image.

Altenbach's answer is great 🙂

 

0 Kudos
Message 4 of 7
(3,343 Views)
Thank you again Altenbach, especially for the speedy reply.
0 Kudos
Message 5 of 7
(3,341 Views)

Pacific , I was just curious as to why on line 4 : a = [ 5 3 10], and the loop is now from 2:4. Of course this is correct, but the code is suppose to find the values of a when i = 1:4.

 

Thanks for the input.

0 Kudos
Message 6 of 7
(3,324 Views)

On Line 5 a = [5 3 10] initializes the array. If the array is not initialized, the concatenate function on line 10 will return an error. A better approach would be:

 

input1 = 5;

input2 = 3;

input3 = 10;

 

a = [input1 input2 input3];

for i=2:4

...and the remaining script.  

0 Kudos
Message 7 of 7
(3,301 Views)