Convert cell array with different data type to a matrix in MATLAB

I imported an excel sheet on matlab in which some columns are characterized by different data, such as numeric values ​​separated by a slash (e.g. 7/8) and normal numeric values . The "cell2mat" command transforms only columns containing the same type of data. What can I do for the remaining columns?

3 件のコメント

Stephen23
Stephen23 2020 年 3 月 2 日
編集済み: Stephen23 2020 年 3 月 2 日
"What can I do for the remaining columns?"
Lots of things. But nowhere in your question do you explain what you expect the output to be like.
What do you want strings like '7/8' to be converted into?
ALESSIA ANTONACI
ALESSIA ANTONACI 2020 年 3 月 2 日
The cell array that I created is made up of 141 rows and 8 columns. Of these 8 columns, some contain the same type of data, i.e. only numbers. Other columns, on the other hand, consist of both simple numbers and numerical values such as 7/8, or 5/6 and also text abbreviations (therefore they are composed of different types of data). Since building vectors for every single column, for those that have the same data type I used the "cell2mat" command. My problem is that I can't create vectors just for those columns containing mixed data. I apologize for not explaining the problem first but it is my first approach to Matlab.
ALESSIA ANTONACI
ALESSIA ANTONACI 2020 年 3 月 2 日
Furthermore, the vectors I want to create must contain the same data as the cell array

サインインしてコメントする。

回答 (1 件)

Divya Gaddipati
Divya Gaddipati 2020 年 3 月 5 日

1 投票

A similar question has already been answered by the community which might be of relevance to you. Please refer to the following link:
Hope this helps!

カテゴリ

製品

リリース

R2019b

質問済み:

2020 年 3 月 2 日

コメント済み:

2020 年 3 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by