write data to header file
11 次查看(过去 30 天)
显示 更早的评论
i have 1x800 double and i need to outpu in header file all this values like this; float sineTable[800] = { /* values go here */ };
0 个评论
采纳的回答
Akira Agata
2019-3-4
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);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!