【发布时间】:2016-06-08 10:46:13
【问题描述】:
我在 Matlab 中构建了一个神经网络并创建了一个使用 NN 的函数。我从该函数生成了 C++ 代码,以便在我的 Arduino Yun 上使用它。
在 Arduino IDE 中,我首先编写了 #include "NeuralNetwork.h" 并且编译没有问题,但我不确定如何从 matlab 编码器中调用生成的函数。函数头是
void NeuralNetwork(const emxArray_real_T *Data, double activity_data[], int
activity_size[2], double *percent)
emxArray_real_T 是什么类型的数据?在 Matlab 中数据是一个 inf x 5 矩阵。
Here我发现有人使用 emxCreateWrapper_real_T 函数,但如果我在 Arduino IDE 中使用此函数,我只会收到错误:
'emxCreateWrapper_real_T' was not declared in this scope
input = emxCreateWrapper_real_T(input_d,5,6);
我在从 matlab coder 创建的任何文件中都找不到这样的函数,我在哪里可以找到?
我正在使用 Matlab R2016a。
我在 Arduino 中的循环功能是:
void loop() {
//input data are samples from a 3D Accelerometer
double input [6][5] = { {30.38,0.584,0.106,0.253,1}, //walking
{30.4,0.772,0.059,0.461,1}, //walkinh
{1.98,0.026,0.13,1.031,2}, //sitting
{2.0,0.01,0.102,1.03,2}, //sitting
{5.0,-1.135,0.035,0.099,3}, //standing
{5.02,-1.14,0.039,0.09,3}}; //standing
//emxArray_real_T *input;
double activity[6]; //output from NN
double percent = 0; //amound of recognized data
int act_size[2]; //???
print_inp(input); //just prints the input array to the serial interface
// input = emxCreateWrapper_real_T(input,5,6);
NeuralNetwork(input,activity,act_size,&percent);
delay(50000);
}
【问题讨论】:
标签: c++ arduino matlab-coder