FREAD() help

3 vues (au cours des 30 derniers jours)
Edward
Edward le 4 Avr 2012
Hi, ive got an array of numbers [2 4 6 8] written into a file by fprintf, Im using n=fread(fid) to get this data from a file,
im getting the numbers [50 32 52 32 54 32 56]
im aware these numbers are ascii format for the numbers in the file,
is there a way i can get the [2 4 6 8] back from these ascii numbers?
Its been suggested that i dont use fprinf but i need to be able to print text aswell as numbers.
thanks

Réponse acceptée

Wayne King
Wayne King le 4 Avr 2012
A = [50 32 52 32 54 32 56];
B = str2num(char(A));

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by