I am trying to run Matlab Code in QT Creature
1 view (last 30 days)
Show older comments
Hello friends, I have these codes in Matlab
function [ Mshifted, f ] = Func1( t0, ts, t1, df )
fs = 1/ts;
t = Time_Vector(t0,ts,t1);
m = Message_Signal(t);
[M,m,df1]=fftseq(m,ts,df);
M=M*ts;
f=[0:df1:df1*(length(m)-1)]-fs/2;
Mshifted = abs(fftshift(M));
end
and result of code generation is here,I tried a few way and this is last one
#include "mainwindow.h"
#include "ui_mainwindow.h"
extern "C"
{
#include "Func1.h"
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
emxArray_real_T *Mshifted;
emxArray_real_T *f;
for(int i =0;i<4096;i++)
{
f->data[i] = 0;
Mshifted->data[i] = 0;
f->size[i] = 0;
Mshifted->size[i] = 0;
}
f->allocatedSize = 4096;
f->canFreeData = (boolean_T)0;
f->numDimensions = 4096;
Mshifted->allocatedSize = 4096;
Mshifted->canFreeData = (boolean_T)0;
Mshifted->numDimensions = 4096;
Func1(-0.2/2,0.001,0.2/2,0.3,Mshifted,f);
//for(int i=0;i<10;i++)
//ui->textEdit->append(QString::number(Mshifted->data[0]));
}
MainWindow::~MainWindow()
{
delete ui;
}
It cant run the program and I have this error,probable it is about with out of border of array Starting D:\Qt Projects\build-untitled-Desktop_Qt_5_11_1_MinGW_32bit-Debug\debug\untitled.exe... The program has unexpectedly finished. The process was ended forcefully. D:/Qt Projects/build-untitled-Desktop_Qt_5_11_1_MinGW_32bit-Debug/debug/untitled.exe crashed.
0 Comments
Answers (0)
See Also
Categories
Find more on Input Specification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!