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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:30:53+00:00 2026-05-25T21:30:53+00:00

I am trying to run a Matlab script from Windows command prompt but I

  • 0

I am trying to run a Matlab script from Windows command prompt but I can’t execute it sometimes. The script runs fine when manually launched. Matlab version is 2011a and Windows is Server 2003 SP2. Details:

Script mytask.m is located inside say E:\Production\Project. This is SAVED on Matlab’s path.

When I place mytask.m inside bin folder, it executes fine by the command:

     `C:\Program Files\MATLAB\R2011a\bin>matlab -r mytask`

If you delete it and try to access it at its original location, the script doesn’t run although Matlab editor window is launched:

     `C:\Program Files\MATLAB\R2011a\bin>matlab -r "E:\Production\Project\mytask"

Any suggestions please? 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-05-25T21:30:54+00:00Added an answer on May 25, 2026 at 9:30 pm

    The syntax for matlab -r is

    matlab -r "statement"
    

    In other words, you need to provide some executable commands as the statement. For example:

    matlab -r "run E:\Production\Project\mytask"
    

    However, it seems that matlab does not load the customized paths in this way. If you have some customized paths, you probably have to define them in startup.m and place this startup.m in the directory where you invoke matlab.

    I didn’t check myself, but if you define E:\Production\Project\ as the path in startup.m, you probably can run matlab -r mytask without problem, as mytask will be recognized as a user function/script.

    A simple example of startup.m

    path(path, 'E:\Production\Project\');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run the example code from the MATLAB Doc, but when
I am trying run a batch file from my java codes, but unfortunately I
I'm trying to call a user-defined MATLAB function from a C application, but I'm
I am trying run a program from a qmake .pro file which modifies the
Trying to run the following command in php to run powershell command... the following
I am trying to run the VS 2008 SP1 installer , but it says
I'm trying to run a batch file, as another user, from my web app.
In MATLAB, when I run the command [V,D] = eig(a) for a symmetric matrix,
I'm trying to run a program originally tested on Matlab 6.5 on a new
I wrote this C program for Win32/c compiler but while i'm trying run this

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.