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!!

采纳的回答

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