简体   繁体   English

如何在MATLAB中运行八度音阶命令行程序

[英]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. 我刚刚下载了Multi-Camera Self-Calibration工具箱的Octave(以及MATLAB)兼容版本。 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? 是否有可能因为我使用的是Win32构建的Octave,而不是本机的linux版本而获得了这些差异(例如0.62 vs. 0.70的像素错误)?

My other and more important question is that how could I run this script (gocal.m) from MATLAB ? 我的另一个更重要的问题是, 如何从MATLAB运行此脚本(gocal.m) This script has a part, which takes the configuration file name from the command line argument --config=. 该脚本有一部分,它从命令行参数--config =中获取配置文件名。 No matter how I try to run this script from MATLAB, it always tells me that something is missing from argv. 无论我如何尝试从MATLAB运行此脚本,它总是告诉我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? 您能告诉我一种如何传递给定数据argv()并使用--config =选项启动所需脚本的方法吗?

  1. from within the MATLAB GUI , with run gocal ... 从MATLAB GUI内运行gocal ...
  2. from command line , with matlab -r gocal ...? 从命令行 ,用matlab -r gocal ...?

argv is an Octave-ism. argv是一个八度主义。 You have two options off the top of my head: 我头上有两个选择:

  1. Pass the configuration file as an argument to gocal , assuming gocal supports that. 假设gocal支持,将配置文件作为参数传递给gocal
  2. Write a function named "argv" that returns '--config...'. 编写一个名为“ argv”的函数,该函数返回“ --config ...”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM