MATLAB Answers

write data to header file

12 views (last 30 days)
Cem SARIKAYA
Cem SARIKAYA on 4 Mar 2019
Edited: Cem SARIKAYA on 5 Mar 2019
i have 1x800 double and i need to outpu in header file all this values like this; float sineTable[800] = { /* values go here */ };

  0 Comments

Sign in to comment.

Accepted Answer

Akira Agata
Akira Agata on 4 Mar 2019
How abou the following?
% Sample data
data = rand(1,800);
% Arrange it to comma-separated string
str = num2str(data);
str = regexprep(str,'\s+',',');
% Save as 'sample.h' file
fid = fopen('sample.h','w');
fprintf(fid,'sineTable[800] = {%s};\n',str);
fclose(fid);

  1 Comment

Cem SARIKAYA
Cem SARIKAYA on 5 Mar 2019
thank you very much for your answer this is exactly what i want

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags