Jun 7, 2005 #1 D davyzhu Advanced Member level 1 Joined May 23, 2004 Messages 494 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Location oriental Activity points 4,436 matlab vector to string Hi all, I have a vector like vec=[1 0 1 0 1 0 0 1...]. How to convert it to string like str='10101001...'? And how to save this string to a file? Best regards, Davy
matlab vector to string Hi all, I have a vector like vec=[1 0 1 0 1 0 0 1...]. How to convert it to string like str='10101001...'? And how to save this string to a file? Best regards, Davy
Jun 7, 2005 #2 E echo47 Advanced Member level 6 Joined Apr 7, 2002 Messages 3,933 Helped 638 Reputation 1,274 Reaction score 90 Trophy points 1,328 Location USA Activity points 33,176 vector to string matlab vec = [1 0 1 0 1 0 0 1]; str = dec2hex(vec)'; fid = fopen('myfile', 'wt'); fprintf(fid, str); fclose(fid); You may also find the dlmwrite function useful.
vector to string matlab vec = [1 0 1 0 1 0 0 1]; str = dec2hex(vec)'; fid = fopen('myfile', 'wt'); fprintf(fid, str); fclose(fid); You may also find the dlmwrite function useful.