Readtable function reads the return of CRSP data as cell array

조회 수: 3 (최근 30일)
David Schaefer
David Schaefer 2019년 10월 11일
댓글: David Schaefer 2019년 10월 15일
I want to work with CRSP stock data in matlab but when I use the funtion readtable to import the data, which I have as a CSV file, I have some issues.
If you look at the picture you see that the function reads the returns of the file as a cell array but I want it as a numeric number just as the price or the shares outstanding.
Is there an easy way to convert it?
Thanks!

채택된 답변

Joe Vinciguerra
Joe Vinciguerra 2019년 10월 11일
편집: Joe Vinciguerra 2019년 10월 11일
This will convert that column to numbers (assuming all elements in that column can be converted to numbers)
(EDIT: sorry I haven't had my coffee yet. This is correct now...)
variableName.RET = str2double(variableName.RET(:));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by