Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Matlab] How to convert vector to string and save it to file

Status
Not open for further replies.

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
 

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.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top