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

  • Home
  • SEARCH
  • 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 6797179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:34:39+00:00 2026-05-26T18:34:39+00:00

I have a question about the following code. [name file] = uigetfile(‘*’, ‘Select an

  • 0

I have a question about the following code.

[name file] = uigetfile('*', 'Select an image');
if [name file] ~= 0
    %file found
end

Is there a way of saying that [name file] can be assigned to an array? For example, Filepath[2] = ui.getfile.. (this doesn’t work).

When I tried the following code, I only get the filename and not the path. Am I declaring this array wrong?

Filepath{2} = uigetfile({'*.wav;*.mp3;*.aac;*.ogg'}, 'Select a file');
%Filepath{2} = uigetfile('*', 'Select an image');
%noFile = Filepath(0);
%if Filepath[1]~= 0
%if Filepath ~= 0

disp('Loading signal');
disp(Filepath);
%disp(Filepath{0});
disp('Filepath{1}');
disp(Filepath{1});
disp('Filepath{2}');
disp(Filepath{2});
  • 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-05-26T18:34:40+00:00Added an answer on May 26, 2026 at 6:34 pm

    I think you may be confused about the syntax for multiple “output arguments” of a function. Unlike most programming languages, MATLAB allows functions to have multiple return values; these are called output arguments. When you have a function [a b] = foo(x), it is best to think of this as just the syntax to send the first output to a variable called a and the second output to a variable called b. Even though the syntax [a b] looks like an array, it is best to not think of it that way.

    Here’s an example of uigetfile:

    [filename, pathname] = uigetfile('*.m', 'Select a file');
    

    which gives the filename and path of the selected file, in variables called filename and pathname, respectively.

    filename =
    
    foo.m
    
    
    pathname =
    
    /home/tobin/
    

    But what I don’t understand is that this method returns zero if it was canceled or a filled array if it was successfull. So how can I check for zero (file not found)?

    Why not try it out?

    > [filename, pathname] = uigetfile('*', 'Select a file')
    
    filename =
    
         0
    
    
    pathname =
    
         0
    

    It appears that both outputs are 0 if the uigetfile is cancelled. So you can do this:

    [filename, pathname] = uigetfile('*', 'Select a file');
    fullname = horzcat(pathname, filename);
    if filename == 0
        fprintf('uigetfile was cancelled.\n');
    else
        fprintf('user selected "%s".\n', fullname);
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about the following C code: void my_function() { int i1;
I have a question about the for_each in vector, the code is following: #include
I have (another) question about indexing. I use the following code: CREATE TABLE [dbo].[PnrDetails1](
I have the following question about JPA: Can I save the order of the
I have a question about using os.execvp in Python. I have the following bit
Following on from a question I posted yesterday about GUIs, I have another problem
I'm sorry about the naive question. I have the following: public Array Values {
I have two questions about the following code. 1. How to constructor the third
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have question about normalization. Suppose I have an applications dealing with songs. First

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.