hyperknot
hyperknot

Reputation: 13966

how to run an octave command line program in MATLAB

I have just downloaded the Octave (and MATLAB too) compatible version of the Multi-Camera Self-Calibration toolbox. It has a built in check and a section in the readme file, which says what are the expected values when that check is run.

The following command line is what starts the built-in check:

octave gocal.m --config=../strawlab/test-data/DATA20100906_134124/no-global-iterations.cfg

From the readme there is a section which tells what are the supposed results from running that check, and what are the final results.

My problem is that I'm getting slightly different values, compared the the ones mentions in the readme. Is it possible that I'm getting these differences (like 0.62 vs. 0.70 for the pixel errors) because I'm using a win32 build of Octave, and not a native linux version?

My other and more important question is that how could I run this script (gocal.m) from MATLAB? This script has a part, which takes the configuration file name from the command line argument --config=. No matter how I try to run this script from MATLAB, it always tells me that something is missing from argv.

The code is the following:

function [config] = read_configuration(filename)

if nargin == 0
  % No argument given -- look for --config= on the command-line.
  found_cfg = 0;
  for cmdline_arg = argv()
    arg = cmdline_arg{1}
    szarg = size(arg);
    if szarg(2) >= 10
      if strcmp(arg(1:9), '--config=')
        found_cfg = 1;
        filename = arg(10:size(arg,2));
      end
    end
  end
  if ~found_cfg
    error('missing --config=FILENAME command-line argument');
  end
end

Can you tell me a way of how to pass on a given data for argv() and start the needed script with the --config= option?

  1. from within the MATLAB GUI, with run gocal ...
  2. from command line, with matlab -r gocal ...?

Upvotes: 1

Views: 1554

Answers (1)

Arthur Ward
Arthur Ward

Reputation: 627

argv is an Octave-ism. You have two options off the top of my head:

  1. Pass the configuration file as an argument to gocal, assuming gocal supports that.
  2. Write a function named "argv" that returns '--config...'.

Upvotes: 1

Related Questions