Change the data from table format to double format

48 views (last 30 days)
Hussein Hasan Mohsen
Hussein Hasan Mohsen on 11 Dec 2020
Commented: Walter Roberson on 13 Jun 2021
Hello everyone
is there any way to change the data from table format to double format in matlab
i want to make the (trainingdata) in double format in one file

Answers (3)

Cris LaPierre
Cris LaPierre on 11 Dec 2020
See this link on how to import a spreadsheet into MATLAB.
See this page for instructions on how to access data in a MATLAB table.

SHIVAM KUMAR
SHIVAM KUMAR on 11 Dec 2020
%Just import the table in matlab and it shall come as double .
%Later you can select the required columns using
trainingdata(:,1) %or trainingdata(:,n);
where n is the required column provided the imported varable is training data. or use that name.
  8 Comments
Walter Roberson
Walter Roberson on 13 Jun 2021
categorical objects are stored according to an internal integer index. You can use methods such as uint8() on the cateogorical objects in order to extract the indices associated with each item.
However, these indices are might not have any relative meaning -- an index of 2 might be in some sense "far" from the entry with an index of 3. Consider for example if the original entries were character vectors of times in AM/PM format, then the 11 AM entry might be beside the 11 PM entry in sorted order.
When the categorical object is constructed, you can give a value to be associated with each category.
But if you are expecting the categorical objects to have relative meaning to be computed on, not just arbitrary class labels that have no inherent meaning, then you should consider creating the categorical objects with "ordinal" setting: you can do arithmetic on those. Such as subtracting the first category for the current entry to find the relative offset.
To convert datetime objects for use, you should pick a consistent base time, and subtract it from your datetime objects. The result will be a duration() object. You can extract numeric information from those such as by asking days() of the duration to get a floating point number measured in days.

Sign in to comment.


Image Analyst
Image Analyst on 11 Dec 2020
Try this:
[numbers, strings, raw] = xlsread('trainingdata.xlsx');
numbers is your double array.

Community Treasure Hunt

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

Start Hunting!