10-30-2008 06:54 PM
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
Solved! Go to Solution.
10-30-2008 07:04 PM
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".
10-30-2008 07:08 PM - edited 10-30-2008 07:12 PM
Here's how it should look like.
10-30-2008 07:19 PM
If you want to use your option 1, use the code in the attached image.
Altenbach's answer is great 🙂
10-30-2008 07:20 PM
10-30-2008 07:33 PM
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.
10-30-2008 10:32 PM
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.