how to convert cell datatype into uint8?

22 ビュー (過去 30 日間)
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2013 年 3 月 3 日
how to convert cell data type into any of the following..logical, double, single, uint8, uint16, uint32, int8, int16, int32. my present input was cell type.My objective is to find the correlation.

回答 (2 件)

Sven
Sven 2013 年 3 月 3 日
Hi Sivakumaran,
A cell datatype is simply a container for other datas. There is a function called cell2mat which will unpack what's in your cell and try to put it in a matrix:
uint8inCell = {uint8(1:4)}
cellContents = cell2mat(uint8inCell)
class(cellContents)
ans =
uint8
It's a little bit like asking "how do I convert a box into a cat?"
Step 1: Put a cat into the box
Step 2: Take the cat out of the box
Does that help clear things up?

Walter Roberson
Walter Roberson 2013 年 3 月 3 日
Try cell2mat() and see if it complains about the number of rows or columns not matching. If it does complain then you cannot do the conversion.
  1 件のコメント
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2013 年 3 月 3 日
cell2mat command works well for my application. Thanks Sven and Walter.

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

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by