M-file Matlab, System Generator and Xilinx Spartan 6 FPGA LX9 Microboard

Status
Not open for further replies.

Emest

Newbie level 2
Joined
Oct 18, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,299
Hi there,

Im new here.

Lately, I am now doing my final year project using Matlab, System Generator and Xilinx Spartan 6 FPGA LX9 Microboard.

In my project, I want to convert m-file to vhdl code in system generator and then program the vhdl code into the Spartan 6 FPGA LX9 Microboard. By the way, my project is mainly doing with the image processing which can recognize the type of material.

However, I face a problem that troubles me alot for the progress of my project. I couldnt sucessfully convert the m-file into vhdl code. I put my m-file inside the Embedded Matlab Function block in the simulink. After the stimulation, it shows an error called "memory allocation error". I have no idea how to solve the error.

Hopefully everyone can help me in order to get my project done in time. Helps from everyone will be highly appreciated. Please.

Thanks in advanced !!! :grin::grin::grin:

Here's my m-file coding :

function y = fcn(u)

eml.extrinsic('imread');
eml.extrinsic('graythresh');
eml.extrinsic('im2bw');
eml.extrinsic('bwtraceboundary');
eml.extrinsic('imshow');
eml.extrinsic('hold');
eml.extrinsic('boundary');

gray=imread(u);
threshold=graythresh(gray);
BW=im2bw(gray,threshold);
BW=~BW;
dim = size(BW);

col = round(dim(2)/2)-90;
row = find(BW, 1 );
boundary = bwtraceboundary(BW,[row, col],'N');
imshow(u)
y=dim;

And here's my simulink model :
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…