필터 지우기
필터 지우기

MATLAB file to C compiler Command changes\ Makefile from MATLAB code

조회 수: 2 (최근 30일)
Alexander Dahlmann
Alexander Dahlmann 2019년 11월 16일
답변: Walter Roberson 2019년 11월 18일
I am currently trying to create a MakeFile for the following code (the data.txt file is just a 166x14 matrix of numbers). The best solution I could find for this is to use the MATLAB C coder and make a MakeFile from that, however the commands 'fscanf' and 'scatter' are not supported for the compiler. Does anyone know how I should change this code to allow it to be compiled? or if there is a better way to create a MakeFile from MATLAB code? Also please excuse my poor coding ability, this is not my expertise and I am still learning more of the best practices.
function [] = Temp_Dat(~)
tec = fopen('data.txt','r');
datr=fscanf(tec,'%f')
fclose(tec);
s=1;
dat=zeros(166,14);
for y_d =1:1:166
for x_d=1:1:14
dat(y_d,x_d)= datr(s);
s=s+1;
end
end
hold on
x_ax=dat(1,1):1:dat(end,1);
y_vec = dat(:,14).';
for x=1:1:166
scatter(x_ax(x),y_vec(x),25,'r','filled')
end
end
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 11월 16일
Are you referring to MATLAB Compiler, or MATLAB Compiler SDK, or to MATLAB Coder?
I would not expect MATLAB Coder to support scatter(), but I would expect MATLAB Compiler to support it.
Alexander Dahlmann
Alexander Dahlmann 2019년 11월 18일
I am currently looking at using MATLAB coder for this.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2019년 11월 18일
MATLAB Coder does not support graphics, except some of the Computer Vision routines to "draw" into arrays, and some specialized device interfaces (e.g., controlling 7 segment LCDs on Arduino)
You can use coder.ceval() to code in calls to external libraries that do graphics for you.
To be honest, the easiest way to fscanf() in MATLAB Coder is to loop doing fgetl() and then coder.ceval() sscanf()

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by