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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:52:44+00:00 2026-06-04T02:52:44+00:00

In an executable Octave script, I want to pass the name of a file

  • 0

In an executable Octave script, I want to pass the name of a file containing a matrix and make gnu octave load that file information as a matrix. How do I do that?

Here is what the script should look like

#! /usr/bin/octave -qf

arg_list = argv()

filename = argv{1} % Name of the file containing the matrix you want to load

load -ascii filename % Load the information

The file passed will be a matrix containing a matrix of arbitrary size say 2×3

1 2 3
5 7 8

At the command line the script should be run as ./myscript mymatrixfile
where mymatrixfile contains the matrix.

This is what I get when I try to execute the script just written above with octave

[Desktop/SCVT]$ ./octavetinker.m generators.xyz                                                                             (05-14 10:41)
arg_list =

{
  [1,1] = generators.xyz
}

filename = generators.xyz
error: load: unable to find file filename
error: called from:
error:   ./octavetinker.m at line 7, column 1

[Desktop/SCVT]$  

Where generators.xyz is the file containing the matrix I need

  • 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-04T02:52:45+00:00Added an answer on June 4, 2026 at 2:52 am

    This should work:

    #!/usr/bin/octave -qf
    
    arg_list = argv ();
    filename = arg_list{1};
    load("-ascii",filename);
    

    when you wrote the line load filename you indicated to the load function to load the file name “filename”. That is to say, you did the thing that is equivalent to load('filename');.

    In both MATLAB and Octave, a function “foo” followed by a space then the word “bar” indicates that bar is to be submitted as a string to foo. This is true even if bar is a defined variable in your workspace.

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

Sidebar

Related Questions

How to make single executable file ( not installation file) that run on every
I have a server executable that talks to Active Directory to retrieve user information.
I want to ignore executable files that do not have an extension For example:
I have an executable jar Client.jar that requires jndi.properties file. Since the jndi properties
When dumping an executable file, I only want the code segment to be printed
I have an executable (no source) that I need to wrap, to make sure
I am trying to write an Octave script that I can run as an
I wrote a small executable in C# .NET that manages a .jar file. Our
I have a portable executable that saves data to a file in the same
I compile a Qt executable using qmake && make on the following project.pro file:

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.