Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9084509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:01:00+00:00 2026-06-16T21:01:00+00:00

As the title says, just wondering if there is a function that works as

  • 0

As the title says, just wondering if there is a function that works as fieldnames (http://www.mathworks.co.uk/help/matlab/ref/fieldnames.html) does, but for cells.

So if I have something like:

a = imread('redsquare.bmp');
b = imread('bluesquare.bmp');
c = imread('yellowsquare.bmp');
d = imread('greysquare.bmp');

e = {a, b, c, d};

I’m trying to retrieve either: a, b, c, d OR the image name without the extension.

I have tried fn = fileparts(e) and fntemp = cell2struct(e,2), but I can’t get it working.

Hope this makes sense
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:01:01+00:00Added an answer on June 16, 2026 at 9:01 pm

    The cell array does not include any meta-information, like field name or file name. If you want access to that information you’ll need to change your data storage structure. Some options include:

    Scalar Structure
    Good for when there is a single name to reference.

    images.red = imread('redsquare.bmp');
    images.blue = imread('bluesquare.bmp');
    

    Use fieldnames(images) to get the names.

    Array of structures
    A little bit more general. Allows completely general names (including special characters and spaces) and additional metadata if you need it (like “size”, “author”)

    images(1).name = 'red';
    images(1).im   = imread('redsquare.bmp');
    images(2).name = 'blue';
    images(3).im   = imread('bluesquare.bmp');
    

    Use {fieldnames.name} to get just the names.

    Containers.map
    Probably more than you need here, but good to know about. help comtainers.map for more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just what the title says. Help greatly appreciated!
So, just like the title says, I need to create an application that gets
Just what the title says. $ ./configure --help | grep -i ucs --enable-unicode[=ucs[24]] Searching
Just like the title says. If you add an item to the hook_menu function
Like the title says I'm just wondering the current support for canvas.toDataUrl ? I
Just what the question title says. I'm using SpringMVC, but that's irrelevant really. I
As the title says, I'm basically wondering if the MediaPlayer streaming support works for
Just like the title says, what is the function session_register( ) used for?
Just as the title says, can I pass a pointer to a function so
Just as the title says, I'm trying to create a script that will take

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.