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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:54:33+00:00 2026-06-15T09:54:33+00:00

I’m running a chunk of matlab code called fit.m this way, clear all; load(‘/pathtomatfile/alldata.mat’)

  • 0

I’m running a chunk of matlab code called fit.m this way,

clear all;
load('/pathtomatfile/alldata.mat')
count = rxw1;
count = double(count);
x_cov = ltgbd;

alldata.mat has several data of interest, i.e.,

rxw1
rbg2
rfd1
wop3, 
ltgbd,
etc.

I can run such script from the command line for a given data of interest (in my example count=rxw1),

matlab -nodisplay -nojvm -nosplash -r ${pathtoscript}fit -logfile lfile.txt

However, I need to automate the running so I can tell matlab to make count = any of the other datasets in the mat file. I.e., I’d like to the script in parallel for different datasets but I’d need something like:

matlab -nodisplay -nojvm -nosplash -r ${pathtoscript}fit -logfile lfile.txt DATAOFINTERESTHERE (i.e., rxw1 count will equal rxw1, etc.)

Is it possible to do what I am suggesting? How would I automate the script to run for any of the datasets I choose by giving the name of the dataset as an input parameter when I call the script?

Once I have that I plan to actually run them all in parallel by submitting jobs through LSF but giving the name of the data of interest as an input, something like this in mind:

bsub -q week -R'rusage[mem=8000]' \
"matlab -nodisplay -nojvm -nosplash -r ${pathtoscript}fit -logfile lfile.txt DATAOFINTEREST"

Sorry if it’s too basic of a Q but I am not familiar with running matlab command line.

  • 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-15T09:54:35+00:00Added an answer on June 15, 2026 at 9:54 am

    You can make fit a function, instead of script. The fit function can have a single input variable pointing to the right data file.
    Then you can run

    matlab -nodisplay -nojvm -nosplash -r "cd ${pathtoscript}; fit('${dataofinterest}');exit;"
    

    EDIT: added this detailed fit fun.

    Your fit function should look something like

    function fit( variableName )
    %
    % run fit for a specific variable from the mat file
    % variableName is a string, e.g. variableName = 'rgb1';
    %
    
    ld = load('/pathtomatfile/alldata.mat');
    count = ld.(variableName); % access variables in mat file as struct fields
    count = double( count );
    % and I believe you can take it from here...
    

    EDIT:
    Similar solution loading mat file into a struct to handle the loaded variables
    can be found here with some more details.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Let's say I'm outputting a post title and in our database, it's Hello Y’all
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms

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.