1239 views|0 replies

6555

Posts

0

Resources
The OP
 

Calling Matlab Data in CCS [Copy link]

I searched many posts on the Internet, but they were all just a few words, afraid that others would learn it. Either they ignored me, or they thought they were superior to me even if they did. It's just a few lines of broken program, I wrote it, take it. A reminder to students who use it, please modify the Q value according to the data you want to process. Q=14;%The data is between -1.x and +1.x, so Q14 is taken x=0; fid=fopen('resdata_a.dat','w');%Open file fprintf(fid,'1651 1 0 1 0\n');%Output file header data_len=length(resdata_a);%Assume that the data to be processed is stored in resdata_a for i=1:data_len if resdata_a(i)>=0 x=round(resdata_a(i)*2^Q);%Round after converting to Q format fprintf(fid,'0x%x\n',x);% output in hexadecimal else x=2^16-round(abs(resdata_a(i))*2^Q);%Find the complement of negative numbers fprintf(fid,'0x%x\n',x);% output end end fclose(fid);%After completion, there will be no information prompt in the Matlab command window

This post is from DSP and ARM Processors
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list