Working with phone number data. Number to String

7 views (last 30 days)
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 Comments
Stephen23
Stephen23 on 28 May 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.

Sign in to comment.

Answers (1)

Andrei Bobrov
Andrei Bobrov on 27 May 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!