<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Cell Arrays and Their Contents</title>
	<atom:link href="http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/</link>
	<description>Loren Shure works on design of the MATLAB language at MathWorks. She writes here about once a week on MATLAB programming and related topics.</description>
	<lastBuildDate>Mon, 13 Feb 2012 13:24:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Loren Shure</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32922</link>
		<dc:creator>Loren Shure</dc:creator>
		<pubDate>Thu, 19 Jan 2012 16:16:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32922</guid>
		<description>Eva-

I don&#039;t have access to MATLAB now but I don&#039;t think you can do that in a vectorized way.  Without seeing your code, I am not sure what you&#039;ve actually tried.  I recommend a for loop, first pre-allocating the output or using something like arrayfun.  If you can&#039;t get either of those to work, please contact technical support.

--Loren</description>
		<content:encoded><![CDATA[<p>Eva-</p>
<p>I don&#8217;t have access to MATLAB now but I don&#8217;t think you can do that in a vectorized way.  Without seeing your code, I am not sure what you&#8217;ve actually tried.  I recommend a for loop, first pre-allocating the output or using something like arrayfun.  If you can&#8217;t get either of those to work, please contact technical support.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eva</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32916</link>
		<dc:creator>eva</dc:creator>
		<pubDate>Wed, 18 Jan 2012 15:49:53 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32916</guid>
		<description>i can&#039;t seem to extract the first entry of each cell into a new variable.
right now i&#039;m doing it (with no success) as follows:


though it seems to create it properly, it produces the error:
&quot;conversion to double from cell is not possible&quot;

thank you,
eva</description>
		<content:encoded><![CDATA[<p>i can&#8217;t seem to extract the first entry of each cell into a new variable.<br />
right now i&#8217;m doing it (with no success) as follows:</p>
<p>though it seems to create it properly, it produces the error:<br />
&#8220;conversion to double from cell is not possible&#8221;</p>
<p>thank you,<br />
eva</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren Shure</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32858</link>
		<dc:creator>Loren Shure</dc:creator>
		<pubDate>Thu, 22 Dec 2011 11:02:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32858</guid>
		<description>Hi Willie,

importdata might not be your best option.  textscan MIGHT be more appropriate, I am not sure.

But to answer your question about indexing into cells, here&#039;s the way.

If C is your Nx1 cell, to get the mth character from the nth line, do the following C{n}(m) - curly braces first to get the contents of the nth row, then smooth parens to index into that array.

--Loren</description>
		<content:encoded><![CDATA[<p>Hi Willie,</p>
<p>importdata might not be your best option.  textscan MIGHT be more appropriate, I am not sure.</p>
<p>But to answer your question about indexing into cells, here&#8217;s the way.</p>
<p>If C is your Nx1 cell, to get the mth character from the nth line, do the following C{n}(m) &#8211; curly braces first to get the contents of the nth row, then smooth parens to index into that array.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Willie Munden</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32856</link>
		<dc:creator>Willie Munden</dc:creator>
		<pubDate>Wed, 21 Dec 2011 22:09:56 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32856</guid>
		<description>So I&#039;m just getting used to using cell arrays and from the matlab help docs it says I should use the function importdata. The file I am inporting to matlab has the following data types:
Ushout, Uchar, Short, Float
All my data is hex formatted and here is what the first few lines look like:

Date:  Mon Dec 05 13:38:15 2011
13:38:16 90 EB 30 00 BA 01 E6 01 B6 02 35 00 3E 0B E6 05 EB
13:38:17 90 EB 30 00 BA 01 E7 01 A2 02 21 00 3E 0B FF 05 EB
13:38:18 90 EB 30 00 BA 01 E8 01 B6 02 21 00 3E 0B E6 05 00
etc.

So once I import the data into matlab using importdata I get a Nx1 cell array with N being the number of lines in the input data file. How do I index to each individual character in each line. I need to do this so I can concatenate multiple individual characters.

After doing the concatenate I will then convert the concatenated hex strings?? to decimal.

Thnaks,
willie</description>
		<content:encoded><![CDATA[<p>So I&#8217;m just getting used to using cell arrays and from the matlab help docs it says I should use the function importdata. The file I am inporting to matlab has the following data types:<br />
Ushout, Uchar, Short, Float<br />
All my data is hex formatted and here is what the first few lines look like:</p>
<p>Date:  Mon Dec 05 13:38:15 2011<br />
13:38:16 90 EB 30 00 BA 01 E6 01 B6 02 35 00 3E 0B E6 05 EB<br />
13:38:17 90 EB 30 00 BA 01 E7 01 A2 02 21 00 3E 0B FF 05 EB<br />
13:38:18 90 EB 30 00 BA 01 E8 01 B6 02 21 00 3E 0B E6 05 00<br />
etc.</p>
<p>So once I import the data into matlab using importdata I get a Nx1 cell array with N being the number of lines in the input data file. How do I index to each individual character in each line. I need to do this so I can concatenate multiple individual characters.</p>
<p>After doing the concatenate I will then convert the concatenated hex strings?? to decimal.</p>
<p>Thnaks,<br />
willie</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren Shure</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32832</link>
		<dc:creator>Loren Shure</dc:creator>
		<pubDate>Mon, 12 Dec 2011 10:30:41 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32832</guid>
		<description>Yasmine-

Check out the function cell2mat: http://www.mathworks.com/help/techdoc/ref/cell2mat.html

--Loren</description>
		<content:encoded><![CDATA[<p>Yasmine-</p>
<p>Check out the function cell2mat: <a href="http://www.mathworks.com/help/techdoc/ref/cell2mat.html" rel="nofollow">http://www.mathworks.com/help/techdoc/ref/cell2mat.html</a></p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yasmine</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32829</link>
		<dc:creator>yasmine</dc:creator>
		<pubDate>Fri, 09 Dec 2011 19:33:40 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32829</guid>
		<description>Hi Loren

would you help me in converting a cell array into a numeric array

in my project i am dividing an image into blocks using mat2cell and make some analysis on each block

i need to convert each block into a numeric array

Thank you in advance</description>
		<content:encoded><![CDATA[<p>Hi Loren</p>
<p>would you help me in converting a cell array into a numeric array</p>
<p>in my project i am dividing an image into blocks using mat2cell and make some analysis on each block</p>
<p>i need to convert each block into a numeric array</p>
<p>Thank you in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32687</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Fri, 18 Nov 2011 13:52:50 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32687</guid>
		<description>Hannah-

Take a look at cellfun.

--Loren</description>
		<content:encoded><![CDATA[<p>Hannah-</p>
<p>Take a look at cellfun.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hannah</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32682</link>
		<dc:creator>Hannah</dc:creator>
		<pubDate>Fri, 18 Nov 2011 05:58:51 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32682</guid>
		<description>Hi Loren,

This is a really simple question, hopefully you can help.. 

I have a cell array, where each cell contains a numeric vector of varying length, and just want to multiply everything by a constant. How?

Thanks,
Hannah</description>
		<content:encoded><![CDATA[<p>Hi Loren,</p>
<p>This is a really simple question, hopefully you can help.. </p>
<p>I have a cell array, where each cell contains a numeric vector of varying length, and just want to multiply everything by a constant. How?</p>
<p>Thanks,<br />
Hannah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32669</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Wed, 16 Nov 2011 12:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32669</guid>
		<description>Kyaw-
Again, with your original arrays in separate variables, there is nothing special you can do.  It would be ok if they instead were fields of structs or in a cell array.  Given the concatenation you want to do, putting the data into a cell array makes the most sense.  If you do have the cell array C, size 1xN, to concatenate all the values into one array is easy, provided the values are commensurate types and sizes (does NOT require them to be the same sizes).  But you would want the arrays you put into cells to be row vectors if possible to avoid more required manipulation.

newArray = [C{:}];

What this does is make a comma separated list of the array values in each cell, e.g., C{1},C{2},...,C{N}  and then places these into a regular array because of the surrounding square brackets.  newArray then is:

[values in C(2),values in C(2),...] or
[ 1x8, 1x 12, 1x 3, 1x30] ---- or length 53

There is good user documentation on this.  I suggest you check out the doc and look for comma-separated lists.

--Loren</description>
		<content:encoded><![CDATA[<p>Kyaw-<br />
Again, with your original arrays in separate variables, there is nothing special you can do.  It would be ok if they instead were fields of structs or in a cell array.  Given the concatenation you want to do, putting the data into a cell array makes the most sense.  If you do have the cell array C, size 1xN, to concatenate all the values into one array is easy, provided the values are commensurate types and sizes (does NOT require them to be the same sizes).  But you would want the arrays you put into cells to be row vectors if possible to avoid more required manipulation.</p>
<p>newArray = [C{:}];</p>
<p>What this does is make a comma separated list of the array values in each cell, e.g., C{1},C{2},&#8230;,C{N}  and then places these into a regular array because of the surrounding square brackets.  newArray then is:</p>
<p>[values in C(2),values in C(2),...] or<br />
[ 1x8, 1x 12, 1x 3, 1x30] &#8212;- or length 53</p>
<p>There is good user documentation on this.  I suggest you check out the doc and look for comma-separated lists.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyaw</title>
		<link>http://blogs.mathworks.com/loren/2006/06/21/cell-arrays-and-their-contents/#comment-32666</link>
		<dc:creator>Kyaw</dc:creator>
		<pubDate>Wed, 16 Nov 2011 01:50:15 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=42#comment-32666</guid>
		<description>Dear Loren,


Thank you for your prompt reply and my tmp cell array is dynamic length with dynamic size depend on the user mouse click on the image.

e.g
tmp1 = [8×1 double];
tmp2 = [12×1 double];
tmp3 = [3×1 double];
tmp4 = [30×1 double];

then I want to have all these sum of cell arrays as one array finally like below.
% Here sum of all cell arrays from the beginning to end  
tmp = [53x1 double]; 
  
So,I didn&#039;t know the final length then how should I set the dynamic end point in the structure.

Pls advise me and I really appreciate your help.


Thanks and best regards
Kyaw</description>
		<content:encoded><![CDATA[<p>Dear Loren,</p>
<p>Thank you for your prompt reply and my tmp cell array is dynamic length with dynamic size depend on the user mouse click on the image.</p>
<p>e.g<br />
tmp1 = [8×1 double];<br />
tmp2 = [12×1 double];<br />
tmp3 = [3×1 double];<br />
tmp4 = [30×1 double];</p>
<p>then I want to have all these sum of cell arrays as one array finally like below.<br />
% Here sum of all cell arrays from the beginning to end<br />
tmp = [53x1 double]; </p>
<p>So,I didn&#8217;t know the final length then how should I set the dynamic end point in the structure.</p>
<p>Pls advise me and I really appreciate your help.</p>
<p>Thanks and best regards<br />
Kyaw</p>
]]></content:encoded>
	</item>
</channel>
</rss>

