필터 지우기
필터 지우기

Can you please explain these line of code?

조회 수: 2 (최근 30일)
Mohammad Wajih
Mohammad Wajih 2015년 1월 3일
편집: Mohammad Wajih 2015년 1월 14일
fid = fopen( geomFile );
xPos = zeros(1,geoSize);
for kk = 1:geoSize;
xPos(kk) = fread( fid, 1, '*uint32' );
end
fclose(fid);
max_xPos = max(xPos);
xdim = max_xPos - min_xPos +1;
Any kind of help is appreciated!!

채택된 답변

Geoff Hayes
Geoff Hayes 2015년 1월 3일
Mohammad - why not step through the code to see what is happening? A file is opened, three matrices are sized, then an x and y an z coordinate is read for each element in the three matrices. The file is closed, and the min and max (x,y,z) coordinate is found. For more information on each function type the following in the Command Window
doc fopen
doc fread
doc fclose
doc min
doc max
As for why the code is doing this, hopefully you have an idea on that! :)
  댓글 수: 4
Mohammad Wajih
Mohammad Wajih 2015년 1월 4일
Thank you Mr. Hayes for your answer. Actually, I don't know who the author of this code is. This code used to work for me but now I don't know why its not working. So, I am trying to understand each and every line. Thanks for your response. I really appreciate it.
Image Analyst
Image Analyst 2015년 1월 4일
I agree with Geoff: calling them dim is a horrible name for the variables since it's really the range of the data, not the dimensions. For example if the data range from 1000 to 1005, that does not mean that the dimension of an array to hold all that data should be 6 - there could be hundreds of pixels in that range. But you really have to define what "its not working" means to you for us to fix it.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by