SMath Studio Forum
»
SMath Studio
»
Questions
»
How to use for-loop inside a function
Rank: Newbie
Groups: Registered
Joined: 03/10/2016(UTC) Posts: 4
|
I'm trying to make a function return a value from a matrix by running a small for-loop inside the function. How should I write it? Couldn't find examples how to use it.
|
|
|
|
Rank: Member Groups: Registered
Joined: 18/05/2010(UTC) Posts: 27 Was thanked: 13 time(s) in 6 post(s)
|
Hi Mikko The loop syntax needs tweaking, and the output variable needs to be defined. The attached file works for me. kertoimetTest.sm (5kb) downloaded 90 time(s).Hope this helps. Brian
|
2 users thanked bdrunagle for this useful post.
|
on 19/03/2018(UTC), on 19/03/2018(UTC)
|
|
Rank: Newbie
Groups: Registered
Joined: 03/10/2016(UTC) Posts: 4
|
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/11/2017(UTC) Posts: 114 Location: Olt county Was thanked: 1 time(s) in 1 post(s)
|
Greetings I have not been able to understand the purpose for which the imagined algorithm is used. As the question arises, it is a case of express identification of a certain value in the "kertoimet" matrix. In this case in 99.99 (9 ...) of cases, the result will be an error. If so then you can avoid ambiguity using the first procedure (case identification) in the attached file. Looking at the problem in terms of practical use, in the first column of the "kertoimet" matrix there are some non-dimensional coefficients corresponding to circular x-ray surfaces with the area expressed in square millimeters. In this case, a linear interpolation of these coefficients would be useful depending on the radius of the circle, and the procedure is the one presented in the case of interpolation. Imagination.sm (7kb) downloaded 32 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
... sorry: I understand nothing in there. Too few information. Yes, you can best fit a circle from few points [not done in Smath]
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
How to use for-loop inside a function
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.