MATLAB Answers

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

4 views (last 30 days)
Alexander Dahlmann
Alexander Dahlmann on 16 Nov 2019
Answered: Walter Roberson on 18 Nov 2019
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');
for y_d =1:1:166
for x_d=1:1:14
dat(y_d,x_d)= datr(s);
hold on
y_vec = dat(:,14).';
for x=1:1:166


Walter Roberson
Walter Roberson on 16 Nov 2019
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.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 18 Nov 2019
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()


Sign in to comment.

Translated by