fortran - Shape error with maxloc -
i have problem code, want find maximum value element of array is.
double precision,dimension(1484,10,10) :: integer,dimension(1484) :: ad1
then try:
ad1= maxloc(a)
i error
ad1= maxloc(a) 1 error: different shape array assignment @ (1) on dimension 1 (1484 , 3)
how should define ad1
?
your maxloc(a)
, without dim=
specifier, returns array of rank 1 , size 3 (the rank of a
). trying assign rank 1 array rank 1 array of different size (1484). error message see these 2 numbers of note.
so, want declare ad1
as
integer, dimension(3) :: ad1
[note if have compiler support intrinsic rank
useful general declaration.]
alternatively, of course, declare ad1
in question, assign 3 elements of it.
Comments
Post a Comment