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 6591733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:27:47+00:00 2026-05-25T17:27:47+00:00

Does Octave have a good way to let the user select an input file?

  • 0

Does Octave have a good way to let the user select an input file? I’ve seen code like this for Matlab, but doesn’t work in Octave.

A gui based method would be preferred, but some sort of command-line choice would work also. It would be great if there were some way to do this that would work in both Matlab and Octave.

I found this for Matlab but it does not work in Octave, even when you install Octave Forge Java package for the listdlg function. In Octave, dir() gives you:

  647x1 struct array containing the fields:

    name
    date
    bytes
    isdir
    datenum
    statinfo

but I don’t know how to convert this to an array of strings listdlg expects.

  • 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-25T17:27:48+00:00Added an answer on May 25, 2026 at 5:27 pm

    You have already the Octave Forge java package installed, so you can create instances of any java class and call any java method.

    For example to create a JFileChooser and call the JFileChooser.showOpenDialog(Component parent) method:

    frame = javaObject("javax.swing.JFrame");
    frame.setBounds(0,0,100,100);
    frame.setVisible(true);
    fc = javaObject ("javax.swing.JFileChooser")
    returnVal = fc.showOpenDialog(frame);
    file = fc.getSelectedFile();
    file.getName()
    

    Btw. I had some troubles installing the package.
    Here is a fix for Ubuntu. that worked also for my Debian Testing.

    EDIT

    @NoBugs In reply to your comment:

    If you need to use listdlg you can do the following:

    d = dir;
    str = {d.name};
    [sel,ok] = listdlg('PromptString','Select a file:',...
                    'SelectionMode','single',...
                    'ListString',str);
    if ok == 1
        disp(str{sel(1)});
    end
    

    This should be compatible with matlab, by I cannot test it right now.

    If you want to select multiple files use this:

    d = dir;
    str = {d.name};
    [sel,ok] = listdlg('PromptString','Select a file:',...
                    'SelectionMode','multiple',...
                    'ListString',str);
    if ok == 1
       imax = length(sel);
       for i=1:1:imax
          disp(str{sel(i)});
       end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a Python replacement for Matlab / Octave bwdist() function? This
Does anyone have some code that will take a TimeZoneInfo field from .NET and
Does anyone have any suggestions for the best / simplest way to view all
Does the standard define what happens with this code? #include <iostream> template <typename Func>
Does Windows Phone 7 have anything like iPhone's UITableView? [Basically, I'm porting an iOS
I have some working code that does amplitude modulation and plots it. However I'm
Does any one know how I can have this happen in a windows phone
Does anyone have a nice solution for GalleryView when I want to display photos
Does map() iterate through the list like for would? Is there a value in
Does anyone know of an equivalent to FxCop/StyleCop for Delphi? I would really like

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.