Edit entries in a table
7 views (last 30 days)
Show older comments
Daniel Buschmann
on 8 Dec 2015
Answered: Walter Roberson
on 8 Dec 2015
Hello together, I need some help with preparing data for a regression. I read data from a .csv file into a matlab table. As you can see in the example below some of the dummy variables are in apostrophes and some are not. A regression will not work with the numbers in apostrophes. Can someone please tell me how to replace these '1' or '0' by 1 and 0? Please excuse me if there is a very simple answer, it's my first time working with matlab.
35631 693 5 '2015-08-07' 1 1 '0' '1'
35632 694 5 '2015-08-07' 1 1 '0' '1'
0 Comments
Accepted Answer
Walter Roberson
on 8 Dec 2015
colno = 7; %the column number
YourTable{:,colno} = num2cell(str2double(YourTable{:,colno}));
Note: any entry that is the empty string '' will be replaced with NaN; anything that is not a number will be replaced with NaN
0 Comments
More Answers (0)
See Also
Categories
Find more on Descriptive Statistics 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!