Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 211113

Submitted on 1 Mar 2013 by Tom

Correct

20Size
Leading solution size is 20.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
zmap1s=uint32(randi(2^32,1000,1));
% Write File to enable memory map load
fid = fopen('zmap1s.dat','w');
fwrite(fid, zmap1s, 'uint32');
fclose(fid);
dir
goal=zmap1s(1)
clear zmap1s
% Create the memmap variable
zmap1s = memmapfile('zmap1s.dat','Format', 'uint32','Writable',true);
zmap1s.data(1:4) % accessing the data
zmap1s.data(end)
y = access_mem_map_file(zmap1s);
zmap1s.data(1:4) % accessing the data
assert(isequal(y,goal));
assert(isequal(zmap1s.data(2),2));
+cody                            access_mem_map_file.m
.                                access_mem_map_file_testsuite.m
..                               zmap1s.dat
goal =
  3346497772
ans =
  3346497772
  4011545343
   557942917
  2443079021
ans =
  1487986100
ans =
  3346497772
           2
   557942917
  2443079021