Monday, May 2, 2011

Creating HTML files with favorite pages loaded in matlab

I have saved the pages with sublink such as
http://usefulcodes.blogspot.com/2011/03/how-to-block-website-in-macos.html
http://usefulcodes.blogspot.com/search/label/matlab
etc...

The first part of the link (below) is the home page. The file structure is saved as text array so that textread function in Matlab reads the content as the cell structure. The structure can be accessed iteratively by file{j}.




filename = 'dsave1.txt';
j = 1;

file = textread(filename, '%s', 'delimiter', '\n', ...
'whitespace', '');

for j = 1:length(file)
link = ['http://www.urlurl.com/' file{j}]
% end

file_name = [num2str(j) '.htm'];

fid =fopen(file_name,'wb'); %_id=%s will do the job
fprintf(fid, '<html><head><title>1</title></head><body>');

fprintf(fid, '<iframe name="FRAME" src="%s" width="1040" height="700" frameborder="0" scrolling="no"></iframe></body></html>',link);

fclose(fid);

j = j+1;

end

Just open with Chrome. Tada!

No comments: