Working with phone number data. Number to String
7 views (last 30 days)
Show older comments
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
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.
Walter Roberson
on 28 May 2017
See https://www.mathworks.com/matlabcentral/answers/342248-how-do-i-keep-my-format-when-exporting-to-csv-or-excel#answer_268722 for more information on formatting them as strings
Answers (1)
See Also
Categories
Find more on Standard File Formats in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!