英文:
Octave : How to use a function of a COM interface that returns multiple values?
问题
在Matlab中,你可以使用返回多个值的ActiveX对象。
这是一个示例代码:
pkg load windows
excel = actxserver('Excel.Application');
workbook = excel.Workbooks.Open('E:\Temp\del\a.xlsx');
worksheet = workbook.Worksheets.Item(1);
range = worksheet.UsedRange;
[numRows, numColumns] = size(range.Value);
workbook.Close(false);
excel.Quit();
这个代码在Octave中也可以工作。
但是,在Octave中使用的接口看起来像这样:
MyComObject.BeatArray(out EventTimes, BeatTypes, TemplateNumbers: OleVariant);
每个返回的参数都是一个双精度数组。你可以在Matlab中使用以下方式:
[a, b, c] = foo.BeatArray
但这在Octave中不起作用。
有办法在Octave中使用这个函数吗?
谢谢!
英文:
In Matlab you can use AxtiveX-objects that return multiple values.
Here's an example code:
pkg load windows
excel = actxserver('Excel.Application');
workbook = excel.Workbooks.Open('E:\Temp\del\a.xlsx');
worksheet = workbook.Worksheets.Item(1);
range = worksheet.UsedRange;
[numRows, numColumns] = size(range.Value);
workbook.Close(false);
excel.Quit();
This also works in Octave.
BUT: The interface I use looks like this:
MyComObject.BeatArray(out EventTimes, BeatTypes, TemplateNumbers: OleVariant);
and each returned parameter is a double-array. It can be used in Matlab using
[a,b,c] = foo.BeatArray
That does not work in Octave.
Is there a way to use that function in Octave?
Thanks!
答案1
得分: 1
-
"COM"接口可通过windows包获得。
-
是的。只要您的函数返回多个输出,那么在Octave中捕获多个输出的方式与Matlab类似。请注意(与Matlab一样),一个由多个元素组成的单个输出不等同于多个输出。
英文:
Your question is actually 2 separate things.
-
The "COM" interface is available via the windows package.
-
Yes. As long as your function returns multiple outputs, then capturing multiple outputs works the same way in octave. Note that (like matlab), a single output consisting of multiple elements is not the same thing as multiple outputs.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论