c# - MATLAB Feval C# 客户端缓存问题
问题描述
我需要在 C# 应用程序中运行 MATLAB 代码。我已阅读官方文档以在我的应用程序中运行 MATLAB 函数。
它有效,但我有一个缓存问题。如果我在 C# 中运行给定的 MATLAB 代码:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
// Create the MATLAB instance
MLApp.MLApp matlab = new MLApp.MLApp();
// Change to the directory where the function is located
matlab.Execute(@"cd c:\temp\example");
// Define the output
object result = null;
// Call the MATLAB function myfunc
matlab.Feval("myfunc", 2, out result, 5, 7, "world");
// Display result
object[] res = result as object[];
Console.WriteLine(res[0]);
Console.WriteLine(res[1]);
Console.ReadLine();
}
}
}
使用以下 matlab 函数:
function [x,y] = myfunc(a,b,c)
x = a + b;
y = sprintf('Hello %s',c);
如果我在 MATLAB 脚本函数中进行更改x = a + b;
,x = a * b;
应用程序将继续返回 a+b=12 而不是 a*b=35。
如何解决这个缓存问题?
解决方案
推荐阅读
- asp.net-core - 仅在 Windows PC 上无法在 ASP.NET Core 上加载文件或程序集“Microsoft.AspNetCore.Connections.Abstractions”
- javascript - 在更改时从表单生成 JSON 字符串以填充营业时间
- java - 我可以从 JDBC 连接运行“源”命令(SQL 脚本)吗?
- twilio - Twilio Studio 将呼叫连接到 SIP
- rust - 为什么在 continue 语句之前循环中的变量赋值算作从不读取?
- sqlite - 错误 NU1202 包 Microsoft.Data.Sqlite.Core 2.0.0 与 uap10.0.14393 (UAP,Version=v10.0.14393) / win10-x64 不兼容。
- c# - 来自动态添加的解析文本框的数据
- javascript - 如何使用 D3 js 创建分组条形可刷图表
- javascript - 可以使用自定义结帐更新 Stripe 中的配置选项吗?
- xml - XmlSerializers 引发 BindingFailure