Extracting individual file data from uigetfile multiselect

I want to use the multiselect feature of uigetfile, and I have done this successfully, returning the pathname and filenames of all of the files that I want. The files Im selecting are images and I want to show the first image in the series in a figure, but I am unable to do this, an error message pops up saying:
"Expected input number 1, I, to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64, logical
Instead its type was cell."
How can I convert the image location from a "cell" to something I can use? My current code:
"[filename pathname] = uigetfile('*.*', 'Pick Images', 'Multiselect', 'on');
image_matrix = fullfile(pathname, filename(1))
imshow(image_matrix)"

 Accepted Answer

To access the data in a cell array you need to use curly braces, not parentheses:
filename{1}
because this
filename(1)
will simply return the first cell, and not the data inside the cell.

1 Comment

@Alyssa Stubbers: The answer is very basic. Please read doc cell again and search for examples concerning the handling of cell arrays in the Getting Started chapters of the documentation.

Sign in to comment.

More Answers (0)

Categories

Find more on Display Image in Help Center and File Exchange

Asked:

on 7 Jun 2017

Commented:

Jan
on 7 Jun 2017

Community Treasure Hunt

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

Start Hunting!