Ola! estou tentando aprender a criar dlls e importar para o mathlab mas sempre fica dando um erro no mathlab quando uso a função loadlibrary, como ainda sou novo em programação certamente estou fazendo algo errado se alguém puder me ajudar agradeço, segue o erro e o codigo em c++ : Index exceeds matrix dimensions. Error in loadlibrary>getLoadlibraryCompilerConfiguration (line 497) compilerConfiguration=compilerConfiguration(1); %unix machines return c and cpp compilers here codigo da dll: dll.cpp #include "dll.h" extern "C" __declspec(dllexport) void MinhaFuncao() { int i,j; float mat[100][2],x,k; i=0; j=0; for(x=0;x<=(6.28);x=x+(0.0628)) { k=sin(x); mat[j]=x; j=j+1; mat[j]=k; i=i+1; j=0; } for(j=0;j<=99;j++) { for(i=0;i<=1;i++) { cout<<mat[j]<<" "; } cout<<"\n"; } getch(); } dll.h #ifndef _MYDLL_H_ #define _MYDLL_H_ #include<stdio.h> #include<iostream> #include<cmath> #include<conio.h> using namespace std; extern "C" __declspec(dllexport) void MinhaFuncao(); #endif