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 198673

Submitted on 30 Jan 2013 by Alfonso Nieto-Castanon

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 =
  1257701957
ans =
  1257701957
  3442166054
  1488214718
   357839259
ans =
  1364963748
ans =
  1257701957
           2
  1488214718
   357839259