open_presc.asv 572 B

12345678910111213141516171819
  1. % Loads a prescription map into a sparse matrix
  2. function prescription = open_presc(batchname)
  3. fid = fopen(batchname,'rb');
  4. presc = [];
  5. presc.x_count = fread(fid,1,'int');
  6. presc.y_count = fread(fid,1,'int');
  7. presc.z_count = fread(fid,1,'int');
  8. Nind = fread(fid,1,'int'); % number of non-zero values
  9. .non_zero_indices = fread(fid,Nind,'int=>int');
  10. beamlets{k}.non_zero_values = fread(fid,Nind,'float=>float');
  11. % add unity to the indices to convert them from C to Matlab style
  12. % indexing:
  13. beamlets{k}.non_zero_indices = beamlets{k}.non_zero_indices + 1;
  14. end
  15. fclose(fid);