- #1
Moly
- 21
- 0
Hi All
I am new to fortran and there are things that I believe fortran should do and don't know how to do it - I am using fortran 77.
1- I know how to declare variables, but i do not know how to make sure that i start out with zeros and not use old data that might have been stored by a previous program run or randomly assigned by the memory. (the equivalent of clear all in matlab)
2- If i declare a 3 by 3 matrix called A, and I want to assign the value 4 for each of the elements of the matrix, what is the simplest way of doing that? Setting A=4 did not work for me. I can put it in a loop but i feel there has to be an easier way if i am doing something as simple as this. [in MATLAB i would simply say A(:,:)=4]
Thanks for your help in advance.
I am new to fortran and there are things that I believe fortran should do and don't know how to do it - I am using fortran 77.
1- I know how to declare variables, but i do not know how to make sure that i start out with zeros and not use old data that might have been stored by a previous program run or randomly assigned by the memory. (the equivalent of clear all in matlab)
2- If i declare a 3 by 3 matrix called A, and I want to assign the value 4 for each of the elements of the matrix, what is the simplest way of doing that? Setting A=4 did not work for me. I can put it in a loop but i feel there has to be an easier way if i am doing something as simple as this. [in MATLAB i would simply say A(:,:)=4]
Thanks for your help in advance.