how to read a cell array into a matrix dataset or several vectors

조회 수: 3 (최근 30일)
Xin CUI
Xin CUI 2013년 6월 23일
HI, please help me with this question. I use textscan to read in a 1X20 cell dataset A. When I open it, it looks like such format A{1,1},A{1,2}...A{1,20}. In each cell it's a vector of 100 numbers. Is there a good way to save this cell into a 100 by 20 matrix? Or 20 vectors with 100 numbers each?
Another question is that when I use textscan to import a dataset mixed with strings and numbers, all the numbers after the string are put into one column together with string variable. For example, I tried to import a csv file with 5 columns, the first one is number, the second is string, and all others are numbers. When I imported this dataset, the first column showed up correctly, the second column is string with all other numbers, the left columns are empty sets. Any idea about this? Thanks.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 6월 23일
  댓글 수: 1
Xin CUI
Xin CUI 2013년 6월 23일
Thank you for your answer. I got the error message "All contents of the input cell array must be of the same data type.". My data include float and integer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by