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 274699

Submitted on 7 Jul 2013 by Claudio Gelmi

Correct

25Size
Leading solution size is 8.
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
 
%%
% Cody External accessibility
% This file may need to change in the future
in_f='http://www.pvplc.org/_volunteer/docs/PVPLC%20Trail%20Crew%20Training%20Jan-Jun%202012.pdf';
out_f='PVPLC.pdf';
urlwrite(in_f,out_f);
fid=fopen(out_f);
urlwrite_out=fread(fid,128,'*uint8');
% Display Correct Binary Data
urlwrite_out(1:16)'
block=urlread(in_f);
% Display invalid binary data
urlread_out=block(1:16)-char(0)
% unicode urlread conversion affects bytes 12 thru 15
n=12
byte_val = access_web_pdf(in_f,n)
byte_correct=181;
assert(isequal(byte_val,byte_correct))
ans =
   37   80   68   70   45   49   46   53   13   10   37  181  181  181  181   13
urlread_out =
  Columns 1 through 8
          37          80          68          70          45          49          46          53
  Columns 9 through 16
          13          10          37       65533       65533       65533       65533          13
n =
    12
byte_val =
   181