Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by mikibelavista

  1. mikibelavista

    problem with forall

    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...
  2. mikibelavista

    reading file problem

    My file: 3515 2.154 3516 2.126 3517 2.098 3518 2.063 3519 2.084 3520 2.114 3521 2.128 . . 13093 2.302 13094 2.294 13095 2.29 13096 2.314 13097 2.314 13098 2.294 13099 2.294 13100 2.279 9586 lines in the file. My code: program pr2 implicit none integer :: i,j real,dimension(9586) :: c...
  3. mikibelavista

    how to read this

    < 1| 255.33 | This will be repeated 90000 times in file. So first number will change length.Also | | creates problem,should I read it as character?
  4. mikibelavista

    reading binary file!!

    Ok,I will try now.
  5. mikibelavista

    reading binary file!!

    character*72 ifname,ofname write(*, fmt="(/'Enter input file name')") read(5,85) ifname 85 format(a72) write(*, fmt="(/'Enter output file name')") read(5,85) ofname open(unit=11, file=ifname, form='unformatted', status='old') open(unit=12, file=ofname)...
  6. mikibelavista

    fortran random number generator

    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?
  7. mikibelavista

    comparing arrays with different dimensions

    SOLVED: forall(x=1:n, i=1:33,a(x)==b(i)) c(x+i-i)=i end forall
  8. mikibelavista

    comparing arrays with different dimensions

    No, take a look: do x=1,n read(30,*)a(x) end do forall(x=1:n, i=1:33,b(i)==a(x)) c(i+x-x)=i end forall do i=1,33 write(31,88)c(i) 88 format(i8) I got exactly the same 33 instead of 27 values.
  9. mikibelavista

    comparing arrays with different dimensions

    STILL I HAVE PROBLEMS module m4 contains subroutine mm(iter,n,b) integer,intent(in) :: iter,n integer,dimension(33),intent(in) :: b integer :: id1,id2,i,x integer,dimension(:),allocatable :: a integer,dimension(33) :: c character(6) :: tfile=" .nmf"...
  10. mikibelavista

    comparing arrays with different dimensions

    Thanks,I have done it this way. program comp implicit none integer :: i,n 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 20 n=1,17 do i=1,29 if (b(i)==a(n)) then c(i)=i end if end...
  11. mikibelavista

    comparing arrays with different dimensions

    ok.For example a=(/2,5,6,7,9/) and b=(/1,2,3,4,5,6,7,8,9) What I want is to get c=(/0,2,0,0,5,6,7,0,9,/). I had tried with nested do looped but it didn't work well.
  12. mikibelavista

    comparing arrays with different dimensions

    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...
  13. mikibelavista

    how to read this?

    Well it does not work. program cz implicit none integer :: i integer,dimension(240) :: x real,dimension(240) :: y open(10,file='s1.dat',status='old') open(11,file='time01.dat',status='unknown') do i=1,240 read (10,50) x(i),y(i) 50 format(2x,i3,2x,f9.6) end do write(11,*)y end forrtl: severe...
  14. mikibelavista

    how to read this?

    < 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.
  15. mikibelavista

    reading from file

    I want to skip first 19 lines(description of file),the in the 20th start numerical values what I really need.How to write this?

Part and Inventory Search

Back
Top