[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Unable to get function changes outside the function.

**From**: |
Manpreet Dhiman |

**Subject**: |
Unable to get function changes outside the function. |

**Date**: |
Mon, 14 Sep 2015 09:36:59 -0700 (PDT) |

Hello everyone,I am creating a function for my project named "CivilOctave ".
In this I have to write complete code using different different functions.
Firstly , I created function for calculation of Stiffness_matrix, Because
some function calculations depends upon it. But I am unable to get
stiffness_matrix outside the function. Which means that when I display
stiffness_matrix inside the function, It works. But Whenever I display it
outside the function (anywhere in main.m file) it display zeros.global
Stiffness_matrix;function
Stiffness_matrix=stif(Stiffness_storey)Number_of_storeys=4;for storey_i =
1:Number_of_storeys Stiffness_matrix(storey_i, storey_i) = ...
Stiffness_storey(storey_i); if (storey_i < Number_of_storeys )
Stiffness_matrix(storey_i, storey_i) = ... Stiffness_matrix(storey_i,
storey_i) + ... Stiffness_storey(storey_i + 1);
Stiffness_matrix(storey_i, storey_i + 1) = ... -
Stiffness_storey(storey_i + 1); Stiffness_matrix(storey_i + 1, storey_i)
= ... Stiffness_matrix(storey_i, storey_i + 1); endif
enddisp(Stiffness_matrix); //works shows calculated correct
values.enddisp(Stiffness_matrix); //did not work, show zeros
matrix.stif(Stiffness_storey); //calling
--
View this message in context:
http://octave.1599824.n4.nabble.com/Unable-to-get-function-changes-outside-the-function-tp4672565.html
Sent from the Octave - General mailing list archive at Nabble.com.

**Unable to get function changes outside the function.**,
*Manpreet Dhiman* **<=**