MATLAB: How to pass a string array to the PowerPoint object Range method in MATLAB 7.0.4 (R14SP2)

MATLAB

I have created a COM object with a Range method. This method accepts a variant and returns a collection of objects.
ppt_app=actxserver('powerpoint.application')
ppt_app.Visible=1
ppt_presentation=ppt_app.Presentations.Add
ppt_slide=ppt_presentation.Slides.Add(1,'ppLayoutTitleOnly')
figure
plot(1:6,sin(2*pi*4*[1:6]))
print -dmeta -noui
ppt_figure1=ppt_slide.Shapes.Paste
t=1:100;
y=sin(2*pi*.1*t);
plot(t,y)
print -dmeta -noui
ppt_figure2=ppt_slide.Shapes.Paste
shapes=ppt_slide.Shapes
When I try to pass more than one string argument as follows
shapes.Range({'Picture 3'; 'Picture 4'})
I receive the following error
??? Invoke Error, Dispatch Exception:
Source: Microsoft Office PowerPoint 2003
Description: Shapes.Range : Illegal value for ^0. Bad type: expected 1D array of Variants, Integers, Longs, or Strings
Help File:
Help Context ID: 0

Best Answer

The object method Range only accepts one-dimensional arrays. However, MATLAB by default creates two-dimensional arrays.
To work around this, apply the following prior to calling the Range method;
system_dependent('COM_SafeArraySingleDim', 1)
This forces MATLAB to export single dimension arrays instead of two-dimensional when exporting arrays to COM objects. Note that the cell array
{'Picture 3'; 'Picture 4'}
elements must separated by a semicolon (";") rather than a comma (",") or a space.