Can you please explain these line of code?
조회 수: 2 (최근 30일)
이전 댓글 표시
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!!
댓글 수: 0
채택된 답변
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
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 Center 및 File Exchange에서 Text Data Preparation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!