How can I convert my script into c code using matlab coder
2 次查看(过去 30 天)
显示 更早的评论
clc;
fileID = fopen('pet_data.dat');
OneByte = fread(fileID,[5000 1]); %first testing for first 10bytes of data
A=uint8(OneByte);
Fs=1000;
Ts=1/Fs;
B= (0:Ts:(length(A)-1)/Fs)';
C=[B A];
When I am trying to convert the above following file into c file using matlab coder it is showing an error that it is a script and doesnot start with a function .
So i tried to give lines like these
function C = read_pet
clc;
fileID = fopen('pet_data.dat');
OneByte = fread(fileID,[5000 1]); %first testing for first 10bytes of data
A=uint8(OneByte);
Fs=1000;
Ts=1/Fs;
B= (0:Ts:(length(A)-1)/Fs)';
C=[B A];
end
but it is not right and i have to take some input arguments to read_pet and i have to use this function somewhere. I am totally confused how can i convert this into a function in c code?
1 个评论
Denis Gurchenkov
2017-7-14
Hi Janani, what is the problem here? If you remove "clc;" and then generate the C code using
codegen read_pet -config:lib -report
then it just works for me (in R2017a)
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!