Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

What do I convert fopen/fprintf to when using Matlab Coder?

gradathopkinsgradathopkins Member Posts: 2
Hi,

I have a function which I am trying to use Matlab Coder to convert to mex and then to C code. It is a simple code, but it needs to write several of the local variables (which are arrays) to text files. In matlab this is easily done using [color=Blue]fopen[/color] to create and open a file for writing, and then using [color=Blue]fprintf[/color] to write the array to the opened file. However these functions are not supported in the Coder and I am not sure what to do.

My Matlab code is basically:


fid_u = fopen('velocity.txt','w');

for j = 1 : 100
fprintf(fid_u,'%16.12f
', u(j,:));
end
fclose('all');


Does anyone know what I should change this to to be able to convert to a mex function and then C/C++ ?
Thanks!,
adam
Sign In or Register to comment.