I have array and I want to compare elements,how many 100.3 10.0 pairs do I have
100.3 10.0
110.0 10.0
100.3 10.0
I have tried this:
program pck
implicit none
real,dimension(10,2) :: a
integer,dimension(10) :: b
integer :: i,check
open(10,file='pic.txt')
do i=1,10
read(10,*)a(i,:)
end do...
I am translating some code form matlab to fortran90,I need to generate random numbers for matrix.
This is how MATLAB code looks like,and gives me the same values all the time.
rand('state',0)
v = 2*(ones(c,1)*aa).*(rand(c,n)-0.5) + ones(c,1)*mm;
Is there any idea how to solve this in FORTRAN?
I have program like this
program comp
implicit none
integer :: i
real,dimension(17) :: a
real,dimension(29) :: b,c
open(10,file='01.txt',status='old')
open(11,file='frekvencije.dat',status='old')
read(10,*)a
read(11,*)b
do i=1,29
if (b(i)==a(1)) then
c(i)=i
end if
end do
write(*,*)c
end...
< 1| 255.33 |
< 2| 32.233353 |
< 3| 27.115475 |
< 4| 24.594143 |
< 5| 32.685696 |
< 6| 21.042452 |
< 7| 47.647877 |
< 8| 92.553001 |
< 9| 96.665306 |
How to format < and |.I have tried with a2 like character but it does not work.
I am running a bash script,large code.I have problems with some arrays in this subroutine:
subroutine atupv(m,n,u,v)
include 'ray.par'
parameter(nnzmax=100000, ndmax=1000)
parameter(nsconst=3*nximax*nzimax,
+ nszero=7*nximax*nzimax,
+...
I have modified one code,guy creates like this input file:
integer*2 veli(nxmax)
open(unit=36, file='vel.mod', form='unformatted')
do 130 k=1,nz
do 130 j=1,ny
do 131 i=1,nx
131 veli(i)=vel(i,j,k)*1000.
130 write(36) (veli(i),i=1,nx)
c...
I need this binary for other program,want to transfer my ascii values but
pr3.f: In program `pr3':
pr3.f:4:
real(nmax) a
1 2
Invalid kind at (2) for type at (1) -- unsupported or not permitted
pr3.f:5:
integer*2(nmax) b
^
Invalid form for...
I have problem that I have two arrays and I want to associate their arguments.But I have not managed this with where construct.
real,dimension(100) :: d,v
d has 6 different values,if d is 3,how to take all array elements of v?
program col2
implicit none
real,dimension(5,4) :: a
real,dimension(4) :: a1,a2
integer :: i,j
open(10,file='m.dat',status='old')
do i=1,5
read(10,*)(a(i,j),j=1,4)
end do
a1=a(1,:)
call comp(a1,a2)
write(*,*)a2
end program
subroutine comp(b1,b)
real,dimension(4),intent(in) :: b1...
I have problem like this:
do k = 1, n_data
do i = 1, c
work_s = vv(i,:) - x(k,:)
w(k,i,:)=work_s
di=1/work_s
di2=di**2
di3=di**3
d(k,i,:)=di2
tri(k,i,:)=di3
select case (k)
case(1)
b1=d(1,:,:)
t1=tri(1,1,:)
q1=tri(1,2,:)
res1=sum(b1,dim=1)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.