using img2xlsx: 3 images in a row

1 view (last 30 days)
hdiba
hdiba on 15 May 2016
Commented: Walter Roberson on 15 May 2016
hi everyone! i am using the function img2xlsx to export images (jpg) to excel. it works fine, but the problem is that i have a lot of jpgs that are positioned in a row next to each other. i would like to sort them like 3 in a row. how do i have to change my command (addimage=img2xlsx(array);) and define this? array is the array with image names. thanks

Answers (1)

Walter Roberson
Walter Roberson on 15 May 2016
img2xlsx appears to be from the File Exchange.
Notice in the description of it this part:
% 4. imgxlsx(imagcell, name, DIR, sheet, dimensions)
% varargin{4} = dimensions. Provide the dimensions of the image(s) in a
% matrix like [LinkToFile,... (The file to link to.)
% SaveWithDocument,... (To save the picture with the document.)
% Left,... (The position (in points) of the upper-left corner of the picture relative to the upper-left corner of the document.)
% Top,... (The position (in points) of the upper-left corner of the picture relative to the top of the document.)
% Width,... (The width of the picture, in points.)
% Height] (The height of the picture, in points.)
% Default = [0,1,1,1,450,352]
% see: https://msdn.microsoft.com/en-us/library/bb209605(v=office.12).aspx
So what you need to do is call the routine multiple times for the same output file name, specifying a different input file name each time and specifying the "dimensions" position of where you want the image to appear.
  2 Comments
hdiba
hdiba on 15 May 2016
i've read it but i don't know how to define the matrix with the appropriate position. can you give me an example?
Walter Roberson
Walter Roberson on 15 May 2016
Use 0, 1 for the first two values.
The last two values should be the width and height of the image you are inserting.
The middle two values should be the upper left coordinate. That would be 1, 1 for the first picture; for the second picture to be placed right beside the first it should be 1 more than the width of the first picture for the first of the two and should be 1 for the second of the two. And so on. The third entry would always be 1 more than the total width of what is to the left of the picture you are putting in now, and the 5th and 6th entries would be the width and height of what you are putting in now.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!