<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255281</link>
    <title>MATLAB Central Newsreader - character array from cell</title>
    <description>Feed for thread: character array from cell</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 03 Jul 2009 20:45:03 -0400</pubDate>
      <title>character array from cell</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255281#662550</link>
      <author>mohammad movassat</author>
      <description>Is there any way I can make a 2*1 character array from a 2*1 cell? I have a 2*1 cell:&lt;br&gt;
f{1}=x+y+1 and f{2}=3x-5y+10, (x and y are syms) I want to have a char G&amp;lt;2*1&amp;gt; with exactly the same elements. &lt;br&gt;
&lt;br&gt;
ps. the Matlab version I'm using is not very updated, so I'm looking for a way using basic commands in matlab not by specific toolboxes.  any suggestions?&lt;br&gt;
&lt;br&gt;
Thank you</description>
    </item>
    <item>
      <pubDate>Fri, 03 Jul 2009 20:55:02 -0400</pubDate>
      <title>Re: character array from cell</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255281#662552</link>
      <author>Sadik </author>
      <description>Hello Mohammad,&lt;br&gt;
&lt;br&gt;
If you pad the shorter character array with a sufficient number of blanks, you should be able to have that char array:&lt;br&gt;
&lt;br&gt;
G(1,:) = 'x+y+1   ';  % I put three blanks at the end.&lt;br&gt;
G(2,:) = '3x-5y+10';&lt;br&gt;
&lt;br&gt;
Best.&lt;br&gt;
&lt;br&gt;
&quot;mohammad movassat&quot; &amp;lt;movassat@gmail.com&amp;gt; wrote in message &amp;lt;h2lqkf$cqp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Is there any way I can make a 2*1 character array from a 2*1 cell? I have a 2*1 cell:&lt;br&gt;
&amp;gt; f{1}=x+y+1 and f{2}=3x-5y+10, (x and y are syms) I want to have a char G&amp;lt;2*1&amp;gt; with exactly the same elements. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ps. the Matlab version I'm using is not very updated, so I'm looking for a way using basic commands in matlab not by specific toolboxes.  any suggestions?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you</description>
    </item>
    <item>
      <pubDate>Fri, 03 Jul 2009 21:22:01 -0400</pubDate>
      <title>Re: character array from cell</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255281#662556</link>
      <author>mohammad movassat</author>
      <description>&quot;Sadik &quot; &amp;lt;sadik.hava@gmail.com&amp;gt; wrote in message &amp;lt;h2lr76$jch$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hello Mohammad,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you pad the shorter character array with a sufficient number of blanks, you should be able to have that char array:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; G(1,:) = 'x+y+1   ';  % I put three blanks at the end.&lt;br&gt;
&amp;gt; G(2,:) = '3x-5y+10';&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Best.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;mohammad movassat&quot; &amp;lt;movassat@gmail.com&amp;gt; wrote in message &amp;lt;h2lqkf$cqp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Is there any way I can make a 2*1 character array from a 2*1 cell? I have a 2*1 cell:&lt;br&gt;
&amp;gt; &amp;gt; f{1}=x+y+1 and f{2}=3x-5y+10, (x and y are syms) I want to have a char G&amp;lt;2*1&amp;gt; with exactly the same elements. &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ps. the Matlab version I'm using is not very updated, so I'm looking for a way using basic commands in matlab not by specific toolboxes.  any suggestions?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thank you&lt;br&gt;
&lt;br&gt;
Thank you, but the issue is that the equations I have are much larger than the equations I showed above. My equations are generated after a couple of algebric manupulations and are vey long. and they are stored in cells. So I need to convert them to char by a command and I can not simply write them as char. &lt;br&gt;
&lt;br&gt;
The equations I showed here were samples.</description>
    </item>
    <item>
      <pubDate>Fri, 03 Jul 2009 21:28:01 -0400</pubDate>
      <title>Re: character array from cell</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255281#662557</link>
      <author>us</author>
      <description>&quot;mohammad movassat&quot; &amp;lt;movassat@gmail.com&amp;gt; wrote in message &amp;lt;h2lqkf$cqp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Is there any way I can make a 2*1 character array from a 2*1 cell? I have a 2*1 cell:&lt;br&gt;
&amp;gt; f{1}=x+y+1 and f{2}=3x-5y+10, (x and y are syms) I want to have a char G&amp;lt;2*1&amp;gt; with exactly the same elements. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ps. the Matlab version I'm using is not very updated, so I'm looking for a way using basic commands in matlab not by specific toolboxes.  any suggestions?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you&lt;br&gt;
&lt;br&gt;
you've been given solutions to your problem earlier...&lt;br&gt;
tell CSSM what ML version you have...&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Fri, 03 Jul 2009 21:34:01 -0400</pubDate>
      <title>Re: character array from cell</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255281#662559</link>
      <author>mohammad movassat</author>
      <description>&quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;h2lt51$m7h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;mohammad movassat&quot; &amp;lt;movassat@gmail.com&amp;gt; wrote in message &amp;lt;h2lqkf$cqp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Is there any way I can make a 2*1 character array from a 2*1 cell? I have a 2*1 cell:&lt;br&gt;
&amp;gt; &amp;gt; f{1}=x+y+1 and f{2}=3x-5y+10, (x and y are syms) I want to have a char G&amp;lt;2*1&amp;gt; with exactly the same elements. &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ps. the Matlab version I'm using is not very updated, so I'm looking for a way using basic commands in matlab not by specific toolboxes.  any suggestions?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thank you&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; you've been given solutions to your problem earlier...&lt;br&gt;
&amp;gt; tell CSSM what ML version you have...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; us&lt;br&gt;
&lt;br&gt;
The solutions did not work, so I'm asking for an alternative.&lt;br&gt;
the version I have is 7.0.4.&lt;br&gt;
&lt;br&gt;
mohammad</description>
    </item>
    <item>
      <pubDate>Fri, 03 Jul 2009 21:56:12 -0400</pubDate>
      <title>Re: character array from cell</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/255281#662560</link>
      <author>Sadik </author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
You can loop through f like this.&lt;br&gt;
&lt;br&gt;
% First determine the longest sequence&lt;br&gt;
maxLength = 0;&lt;br&gt;
for k = 1:length(f)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;currentSeqLength = length(char(f{k}));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if currentSeqLength &amp;gt; maxLength&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;maxLength = currentSeqLength;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
% Now that we know the maximum length, we can now loop through f and get &lt;br&gt;
% the character array, say charF.&lt;br&gt;
&lt;br&gt;
for k = 1:length(f)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;currentSeq = char(f{k});&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;charF(k,:) = [currentSeq repmat(' ',1,maxLength-length(currentSeq))];&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
This should now work as you wanted.&lt;br&gt;
&lt;br&gt;
Best.&lt;br&gt;
&lt;br&gt;
&amp;lt;h2ltg9$ekf$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;h2lt51$m7h$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;lt;h2lqkf$cqp$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Is there any way I can make a 2*1 character array from a 2*1 cell? I have a 2*1 cell:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; f{1}=x+y+1 and f{2}=3x-5y+10, (x and y are syms) I want to have a char G&amp;lt;2*1&amp;gt; with exactly the same elements. &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ps. the Matlab version I'm using is not very updated, so I'm looking for a way using basic commands in matlab not by specific toolboxes.  any suggestions?&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Thank you&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; you've been given solutions to your problem earlier...&lt;br&gt;
&amp;gt; &amp;gt; tell CSSM what ML version you have...&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; us&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The solutions did not work, so I'm asking for an alternative.&lt;br&gt;
&amp;gt; the version I have is 7.0.4.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; mohammad</description>
    </item>
  </channel>
</rss>

