필터 지우기
필터 지우기

Reshaping array

조회 수: 2 (최근 30일)
James
James 2011년 11월 1일
Hi all
I have a run a program in Fortran that creates an array 40 columns by 19 rows. When I output this to an ascii file in Fortran it reads the numbers moving from left to right from each row into an array with 7 columns. This gives me an array of 7 columns by 112 rows with the last five values as Nan's in the last row.
Im using Matlab to create images with the data I have. I have been advised to import this array into Matlab and reshape this back into a 40x19 array rather than use a complicated Fortran statement to keep it formatted in the ascii file. However the Nan's give me problems with this.
So effectively what I have is something that looks like this: 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ... 91 92 Nan Nan Nan Nan Nan
Does anyone know how I can either keep this formatted correct using fortran or reshape this array in Matlab?
  댓글 수: 1
James
James 2011년 11월 1일
well it looks like this:
14 15 16 17 18 19 20... new row ... 21 22 23 24 25 26 27 ... ... ... 91 92 Nan Nan Nan Nan Nan

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 1일
reshape(YourData(~isnan(YourData)), 40, 19)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fortran with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by