Change the data from table format to double format

99 visualizzazioni (ultimi 30 giorni)
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

Risposte (3)

Cris LaPierre
Cris LaPierre il 11 Dic 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 il 11 Dic 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 Commenti
Image Analyst
Image Analyst il 13 Giu 2021
But you said you wanted a dobule format so I assumed you would only use the numerical columns in table2array(). So, since you evidently want to include ALL columns, exactly what do you want to do with the categorical and date time columns? What double do you want to convert those to???
Walter Roberson
Walter Roberson il 13 Giu 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.

Accedi per commentare.


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

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by