write data to header file

11 Ansichten (letzte 30 Tage)
Cem SARIKAYA
Cem SARIKAYA am 4 Mär. 2019
Bearbeitet: Cem SARIKAYA am 5 Mär. 2019
i have 1x800 double and i need to outpu in header file all this values like this; float sineTable[800] = { /* values go here */ };

Akzeptierte Antwort

Akira Agata
Akira Agata am 4 Mär. 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 Kommentar
Cem SARIKAYA
Cem SARIKAYA am 5 Mär. 2019
Bearbeitet: Cem SARIKAYA am 5 Mär. 2019
thank you very much for your answer this is exactly what i want

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by