MatLab编码器-MatLab到C [英] MatLab Coder - MatLab to C

查看:198
本文介绍了MatLab编码器-MatLab到C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行MatLab Coder,将matlab .m文件转换为.mex,以希望更快地运行代码. 尝试通过MatLab Coder引擎构建文件时,出现以下错误:

I am trying to run MatLab Coder to transform a matlab .m file into .mex to hopefully run the code more quickly. When trying to build the file via MatLab Coder engine, I get the following error:

Undefined function or variable 'k'. The first assignment to a local variable determines its class.

k是在上一个循环中确定的.我的猜测是C代码无法记住"较早循环中的值.我怎么能解决这个问题?

k is determined inside a previous loop. My guess is that C code cannot "remember" values inside an earlier loop. How can I come around this?

感谢您的帮助.

谢谢.

推荐答案

由于所有未定义的函数或变量"错误都在变量上,并且所有变量均为1 x 1的双精度,因此您必须将它们全部定义为0它们在for循环中定义.看来您无法在for循环中定义它们.

Since all of "Undefined function or variable" errors were on variables, and all variables were 1 x 1 doubles, you have to just define them all as 0 prior to them being defined in a for loop. It seems you can not define them in a for loop.

这篇关于MatLab编码器-MatLab到C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆