Working with phone number data. Number to String

7 visualizzazioni (ultimi 30 giorni)
Cam
Cam il 27 Mag 2017
Commentato: Walter Roberson il 28 Mag 2017
Using a bunch of data from an excell sheet im reading in phone numbers to sort the problem is that some of the numbers matlab reads in as numbers not strings if they dont have hypens for example >>> 9301923334 is a number but 930-192-3334 is a string when import them I use xlsread like this.
[numbers,strings,raw] = xlsread('contacts.xls');
for i = 1:length(numbers)
newarray(i) = num2cell(numbers(i));
end
this gives me an array of numeric data and string data which is great but the numbers array always uses scientific notation in when i use num2cell so the phone number will show up like >> 9.301923334+09 i need some way to get this to be formatted like a phone number or at least in a cell with just the numbers Thanks for all your help!!!
  2 Commenti
Stephen23
Stephen23 il 28 Mag 2017
Why not fix the problem at the source? Ensure that all cells with telephone numbers are formatted as text, and then you avoid this whole problem.

Accedi per commentare.

Risposte (1)

Andrei Bobrov
Andrei Bobrov il 27 Mag 2017
One way
c = xlsread('A.xlsx');
out = sprintfc('%d',c);

Community Treasure Hunt

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

Start Hunting!

Translated by