Skip to main content
1-Visitor
July 25, 2019
Solved

I have a problem with Matrixs and if/for loop

  • July 25, 2019
  • 1 reply
  • 2798 views

I tried to create a program that can calculate capacity of a concrete column. However, I had a problem with matrixs and if/for loop. Even my input is a matrix; my output of for/if loop is a number. I could not solve that. Project is attached. I would be glad if anybody can help me and solve this. 

Best answer by LucMeekes

Maybe this helps:

The result of a program is the result of the last executed statement before it ends.

If you run through a vector or matrix element by element and your last statement assigns the last element of your vector or matrix, than that (last element value) is the result of your program.

Note that in the programming palet there is a 'result' item which requires a parameter. You should use that at the end of your program, after any (nested) for loop and supply the (full) name of the result vector or matrix as the parameter.

Note that the 'result' item causes your program to stop. If you use it anywhere in a program, that's where it stops.

 

Success!
Luc

1 reply

LucMeekes23-Emerald IVAnswer
23-Emerald IV
July 25, 2019

Maybe this helps:

The result of a program is the result of the last executed statement before it ends.

If you run through a vector or matrix element by element and your last statement assigns the last element of your vector or matrix, than that (last element value) is the result of your program.

Note that in the programming palet there is a 'result' item which requires a parameter. You should use that at the end of your program, after any (nested) for loop and supply the (full) name of the result vector or matrix as the parameter.

Note that the 'result' item causes your program to stop. If you use it anywhere in a program, that's where it stops.

 

Success!
Luc

Sarp221-VisitorAuthor
1-Visitor
July 25, 2019

Hello Luc,

Thanks for your answer. However, I did not use any "result" in the loop. I tried to use two "for" loops and one "if" to compare values of a matrix with two limits and get a new matrix. But it gives only the last parameter.  

23-Emerald IV
July 25, 2019

That's what I explained. The progam results in the last executed statement. That is e3j.

You HAVE to use 'result'.

 

Success!
Luc