Change the data from table format to double format
이전 댓글 표시
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
답변 (3개)
Cris LaPierre
2020년 12월 11일
1 개 추천
SHIVAM KUMAR
2020년 12월 11일
%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
Hussein Hasan Mohsen
2020년 12월 11일
Cris LaPierre
2020년 12월 11일
편집: Cris LaPierre
2020년 12월 11일
A table is just a container. Run this command to see the data type of your variables.
summary(trainingdata)
Hussein Hasan Mohsen
2020년 12월 11일
Kachukwu Okoh
2021년 6월 10일
편집: Kachukwu Okoh
2021년 6월 10일
I am having this same question you asked earlier
Please could you let me know the other way you found on how to change a table format to a double format. Really in need of it urgently.
Thanks
Image Analyst
2021년 6월 10일
@Kachukwu Okoh, have you tried table2array()?
Kachukwu Okoh
2021년 6월 12일
Hello @Image Analyst
Yeah table2array() didn’t work. I got an error saying ‘unable to concatenate the specified table variables’
So my data consists of different data types (numerical, categorical and date time) and I have been trying to load it into the workplace as a double to use for data prediction with Neural Network tool and ANFIS
Image Analyst
2021년 6월 13일
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
2021년 6월 13일
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.
Image Analyst
2020년 12월 11일
Try this:
[numbers, strings, raw] = xlsread('trainingdata.xlsx');
numbers is your double array.
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
