<html>
<head>
<meta content="text/html; charset=ISO-2022-JP"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#330000">
On 07/11/2011 23:19, Iai Masafumi ax wrote:
<blockquote cite="mid:4EB85967.4060004@axelspace.com" type="cite">
<pre wrap="">Thanks for your reply. I wanted to use a cell array to manage a lot of
variable in my code which is more complicated.
I guess I have to put my question in a different way:
After running the code below, type(II(1)) returns 17 while type(ii)
returns 1. According to the help, 1 means "real or complex constant
matrix". 17 means "matrix oriented typed list (mlist)". How do I convert
II(1) into a "real or complex constant matrix"?
</pre>
</blockquote>
hi<br>
<br>
you could use :<br>
<br>
m=cell2mat(II) //converts cell to matrix, what you asked.<br>
m(1,:)<br>
<br>
<br>
<br>
if you build yourself the cell, i am guessing you are trying to
mimic something you are used to do with matlab<br>
in that case, consider:<br>
<br>
1-using structures instead of cells <br>
<pre wrap="">y=[100:110]
ii=[1 3 5 7];
jj=[2 4 6 8];
y(ii) // OK. This is an ordinary way.
//build
II.actual_name_i=ii;
II.myindexes=jj;</pre>
//access<br>
y(II("myindexes
"))<br>
y(II.actual_name_i
)<br>
<br>
//useful for loops<br>
fieldnames(II)<br>
<br>
2-using hypermatrices if ii and jj will always have the same size<br>
II = zeros(1,4,2)<br>
II(:,:,1) = ii;<br>
II(:,:,2) = jj;<br>
<br>
y(II(:,:,1))<br>
<br>
<br>
hope this helps<br>
<br>
<div class="moz-signature">-- <br>
Adrien Vogt-Schilb (Cired) <br>
Tel: (+33) 1 43 94 <b>73 77</b></div>
</body>
</html>