MATLAB Answers

0

Database toolbox downloading individual data as cell arrays

Asked by Azura Hashim on 20 Jul 2016
Latest activity Answered by Azura Hashim on 22 Jul 2016
Hi, I am using database toolbox to fetch data using MySql. However the fetched data matrix consists of individual values as cell arrays. How can I download the data as a matrix consisting as simple values? I simply want to download the entire table as a simple matrix. Thanks.

  0 Comments

Sign in to comment.

2 Answers

Answer by Guillaume
on 20 Jul 2016

I don't have the database toolbox but I assume it returns the contents of a table as a cell array because there is no guarantee that the columns are numeric and never empty.
If you are sure that the columns are always numeric and never empty, then:
dataasmatrix = cell2mat(yourfetcheddata)

  0 Comments

Sign in to comment.


Answer by Azura Hashim on 22 Jul 2016

Excellent, this works. Thanks for your help.

  0 Comments

Sign in to comment.