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)"

 采纳的回答

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 个评论

@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.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Display Image 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by