How to publish text and pictures in a loop
古いコメントを表示
I want to make a simple catalog over screen clips, which I captured with the Windows 7 Snipping Tool. That's simple with a for-loop, I thought. That would output text, picture, text, picture, etc. However, the script below produces a block of text followed by the pictures. (R2012a).
Next, I included the text in the figure with the function, title. However, I have set a max width as an publish option. In many cases that made the text unreadable small.
Using the errordlg to show the text is not attractive.
Have I missed an option in publish?
Is there a simple work around?
%%Snipping Tool clips
file_spec = fullfile( folder_spec, '*.png' );
sad = transpose( dir( file_spec ) );
for sa = sad
fprintf( '%s | %8u | %s\n', datestr(sa.datenum,31), sa.bytes, sa.name )
... create a figure with an axes
pic = imread( fullfile( folder_spec, sa.name ), 'png' );
imagesc( pic )
end
1 件のコメント
Walter Roberson
2012 年 7 月 7 日
No drawnow() ?
採用された回答
その他の回答 (1 件)
per isakson
2012 年 7 月 8 日
編集済み: per isakson
2013 年 8 月 8 日
8 件のコメント
Walter Roberson
2012 年 7 月 8 日
Whoa! A pure comment makes a difference ?? It isn't written as a pragma!
per isakson
2012 年 7 月 9 日
francesco
2013 年 7 月 18 日
Hello I've tried to publish "test 1" but it doesn't work on R2007B. I think my Matlab version need the "for" and "and" statement of the loop to be inside the same cell. So the part:
%% Test 1 for ii = 1 : 3 %%
is considered an incomplete statement. Can someone help me?
per isakson
2013 年 7 月 18 日
francesco
2013 年 7 月 19 日
Thank you very much for answering! Please find below results of the four trials:
TEST 1
no images are printed and the following text appears:
2Error: At least one END is missing: the statement may begin here."
TEST 2 produces the following:
All the text parts are reported at the beginning:
Picture: 1 Picture: 2 Picture: 3
And below just one image is printed
TEST 3 produces the following:
Picture: 1 Picture: 2 Picture: 3
And below 3 images are printed
TEST 4 same results of TEST 3
per isakson
2013 年 7 月 19 日
francesco
2013 年 7 月 22 日
Yes, I think this is the only to overcome the problem. Thank you very much for your help ! Best regards
Peter
2013 年 7 月 29 日
And something else to watch out for: Following this answer I discovered (2012b) that a try catch block around the section ment to flush the figures is a problem. For me, I had to remove the try catch, otherwise the %% had no effect in within the loop.
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!