**convert to cell array into a character array or cell array of strings**Hi
I have this horizontal array of names:
Name Size Bytes Class Attributes
itemNames 1x70 7428 cell
I need to convert this into a a character array or cell array of strings.
I tried:
S = char( itemNames)
??? Error using ==> char
Cell elements must be character arrays.
I tried also:
S = cellstr( itemNames)
??? Error using ==> cellstr at 34
Input must be a string.
I appreciate your help,
thanks,
Manal
"Manal " <news@mathworks.com> wrote in message <guqdbh$qci$1@fred.mathworks.com>...
&...

**Cell arrays containing cell arrays**Hi Everyone,
I have data in cell arrays containing cell arrays. I would like to extract data from these cell arrays and store in a normal array. I am able to do it for a particular case using nested for loops. But I would like to generalize this problem such that I can extract any kind of cell array containing cell arrays just like cell2mat function does. Please let me know if there is any solution to this problem.
Thanks,
Anil Palaparthi.
Already discussed here:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/253738
Bruno
Anil Kumar Palaparthi wrote:
> I ha...

**Access to cell array in cell array**Hallo.
I have a problem with a cell array.
It's a 12x2 cell array.
And in the second column in each row of this cell array is again a 13x1 cell array. In the 8th cell there is a column vector.
I tried to gain access to this column vector in the 8th cell for finding the minimum at once of all 12 cells in the second column. But I failed.
It looks like that:
samples_merged{i,2}{8,:} where i runs from 1 to 12.
I am able to solve the problem with a loop, sure, but if anyone comes up with an idea without a loop, I would be happy.
Kind regards,
Gudrun
In article <10143048.1204191328840.J...

**Changing matrices in cell arrays except for one cell array in a cell**Hey guys I need your help once again! I hope someone can show me how to do this. So I have a cell MTT with "d" cell arrays in it, each cell array contains a matrix of nxn and I need to change a whole row of numbers to Inf in every matrix except for one of them which is going to be given by variable "b". MP is a matrix with a dx2 dimension. Here is my code but this will do it for all matrices, I want to find a way to not do it for "b",
for d = 1:numMachines;
MTT{d}(MP(b,2),:) = Inf;
end
Now I have tried doing the following but I guess I can not do...

**Expanding Cell Array within a Cell Array**I have a 10000x1 cell array, and within each of those cells a 1x5 cell array.
Every cell contains numbers stored as characters.
How do i go about converting it to a 10000x5 matrix of doubles?
Thankyou in advanced
"Jordan" wrote in message <jp1gn9$krj$1@newscl01ah.mathworks.com>...
> I have a 10000x1 cell array, and within each of those cells a 1x5 cell array.
>
> Every cell contains numbers stored as characters.
>
> How do i go about converting it to a 10000x5 matrix of doubles?
>
> Thankyou in advanced
Jordan:
This probably isn't the be...

**Part of cell array into another cell array**Hello
I would like to know how can I put a part of a cell array into another
cell array without use for or while loops.
For example:
"points" is a cell array of dimensions 1 x 16. The elements of
"points" consists on matrices of several sizes.
Now I want to introduce "points{1:5}" into another cell array of
dimensions 1 x 5 without using loops. How can I do this?
Thanks in advance.
help deal
e.g.
[points2{2:6}]=deal(points{1:5});
Jos� L. G�mez wrote:
> Hello
>
> I would like to know how can I put a part of a cell ...

**Processing Cell Array of Cell Array of Strings**Hi,
So I have a cell array of a cell array of strings that I am working with.
As an example consider the following:
test=cell(5,1);
test{1,1}{1}=num2str(1);
test{1,1}{2}=num2str(0);
test{2,1}{1}=num2str(0);
test{2,1}{2}=num2str(0);
test{3,1}{1}=num2str(1);
test{3,1}{2}=num2str(1);
test{4,1}{1}=num2str(0);
test{4,1}{2}=num2str(0);
test{4,1}{3}=num2str(0);
test{5,1}{1}=num2str(0);
test{5,1}{2}=num2str(1);
test{5,1}{3}=num2str(0);
I want to process this cell array of cell array of strings so that the inside cell array is removed to make it easier to analyze and look at the...

**Breaking Up Large Cell Array into Smaller Cell Arrays**Hello,
I have a unique problem. Right now I have a large cell array and I want to break that cell array into smaller cell arrays. Here is a portion of the large cell array:
C =
[1x35 char] [1x39 char] 'ALAMEDA' 'CA'
[1x30 char] [1x20 char] 'ALAMEDA' 'CA'
[1x30 char] [1x20 char] 'LUDINGTON' 'MI'
[1x30 char] [1x20 char] 'LUDINGTON' 'MI'
Now, for this test case I want to break this into two smaller cell arrays according to...

**Converting cell array of strings to cell array of numbers**I have
x =
Columns 1 through 11
'1' '10' '11' '12' '13' '14' '15' '16' '2'
'3' '4'
Columns 12 through 22
'5' '6' '7' '8' '9' '1' '10' '11' '12' '13'
'14'
Columns 23 through 33
'15' '16' '2' '3' '4' '5' '6' '7' '8' '9'
'1'
Co...

**Assignment of a cell array to a portion of another cell array**Hello, I have a question. I think my problem has to do with a fundamental lack of knowledge about how indexing works in Matlab.
Here is my code:
Assume D3 is a data structure containing 3 fields, each field is an nx1 array.
D3.F1 = [1 2 3 4]
D3.F2 = [5 6 7 8]
FL = fieldnames(D3);
data{:,3} = num2cell( D3.(FL{2}) ) %so I am trying to fill the third column of cell array "data" with the contents of the array of the second field of D3.
What I get is data{1,1} containing a cell which contains the entire cell array of D3.F2.
Can someone tell me how to make this assi...

**function that takes a cell array and outputs cell array**Hello I'm sorry if this is a really obvious problem but I am having a hard time finding the specific answer to this on the internet.
I am trying to write a function that has a cell array as an input argument and outputs a cell array. I have written the following lines, which at this point should just output the same array as was input:
function outTable = coltable(inTable)
for i = 1:size(outTable,1)
for j = 1:size(outTable,2)
outTable{i,j} = inTable{i,j};
end
end
However, when I try to call the function using the following lines:
B = {1 2 3 ; 4 5 6}
outGU...

**How to sort cell array of cell arrays by inner value**I have a 1 x 500 cell array where each cell is a 1 x 4 cell array. The
inner 1 x 4 cell array has a double numeric value in the 4th cell. I
would like to sort the 500 cells by this numeric value. What is the
best way to do this? Thanks
In article <1191983851.468137.61110@r29g2000hsg.googlegroups.com>,
G.A.M. <x0Zero@gmail.com> wrote:
>I have a 1 x 500 cell array where each cell is a 1 x 4 cell array. The
>inner 1 x 4 cell array has a double numeric value in the 4th cell. I
>would like to sort the 500 cells by this numeric value. What is the
>best way to do this? Thank...

**Create 4x4 Cell Array and not 1x1 Cell Array**Hello,
I have the following:
A = [1 2; 4 5]
And B = 'hello'
I want to create two cell arrays where each element is a 1 by 1 matrix.
Something like I would have doing:
A_Cell = {1 2; 4 5} and B_Cell = {'hello'}
If I do A_Cell = {A} and B_Cell = {B} I don't get what I want.
Can somebody tell me how to do this?
Thanks,
Miguel
A_cell = num2cell(A(:));
B_cell = num2cell(B(:));
Are they what you want?
...

**Assigning Cell Array to Portion of Another Cell Array**I have a bunch of 1D cell arrays that I wish to combine into a 2d cell array matrix. I am having trouble coming up with a statement that will do this. My current plan of action is to create my 2D cell array and then assign each 1D array to a particular column of the 2D array.
So I have a 1D cell array:
a =
'ay'
'be'
'ce'
'de'
I make a 2D cell array:
c = cell(4,10);
I want to stick the contents of a{1} into c{1,5}. Then I want to stick the contents of a{2} into c{2,5}. and so on for all 4 elements of a.
when I try the stat...

**How do I extract a character array from a cell array (so that each cell = a row)??**I have a text file that I read in to Matlab using textscan, and have
the data extracted into cell arrays. The cell array I'm working with
consists of x number of cells, each containing strings (which should
really be numbers). I would like to create a non-cell variable that
has 1 column, with x number of rows.
The main problem is that I can create a variable that has all the
strings from the cell array, but since some digits are single and some
are double, the rows do not necessarily correspond to the original
cells.
How can I get the contents of each cell to = a row in a new variable?...

**HELP: How to combine two cell arrays into one cell array?**I have two cell arrays. I can not figure out how to get them combined into
one simple cell array.
In the world of OOP, wouldn't it be nice if you could just do it this way.
S3 = S1 + S2; % C++ wishful thinking
% How can I do this in MATLAB
S1 = { 'Why', 'do', 'some', 'things' };
S2 = {'have', 'to', 'be', 'so', 'difficult', 'in', 'MATLAB?'};
desired result
S3 = {'Why', 'do', 'some', 'things' , 'have', 'to', 'be', 'so', 'difficult...

**Concatenate cell array of characters & cell array of spaces.**Hi, I need help.
I'd like to add a whitespace at the end of each element of a cell
array of characters.
A = {'A','BC','DEF'};
I'd like to have the following result without any loop.
A={'A ','BC ','DEF '};
Thank you in advance,
David.
"David Dianand" <ddianand@ren.com> wrote in message
news:eed22ab.-1@webx.raydaftYaTP...
> Hi, I need help.
>
> I'd like to add a whitespace at the end of each element of a cell
> array of characters.
>
> A = {'A','BC','...

**vectorizing cell arrays; making cell arrays faster; for loops**I understand that typically "vectorizing" and removing for-loops makes Matlab code (within Matlab, I'm not talking about compiling/hand-converting to C, C++, etc.)
faster inside the Matlab application.
However, I have successfully "vectorized" some code involving "cell arrays" and it appears not to be significantly faster, it even may be somewhat slower.
Is this to be anticipated?
Is there a general paradigm for speeding up cell array operations?
Is a double-for loop the best way to do this?
Thanks,
Sincerely,
Joseph
PhD and Matlab "exper...

**Cell arrays-problem Getting values out of the cell array and using it**Dear all, i have a pbm with the cell array and i do not know how to
let matlab extract the value of my variable, 'repetitions' from the
cell array.pls advise me. Below is the snipplet of the code where it
failed.
%Open diaglou box for user to input number of repetitions needed to
compute the result
prompt = 'Enter the number of repetitions needed to calulate the
average error rates:';
title = 'Input for number of repetitions';
num_lines = 1;
default = {'10'};
repetitions = inputdlg(prompt, title, num_lines, default);
%some mistakes here,not sure
%Check to see...

**Error: cannot support cell arrays containing cell arrays or objects**I created a cell array from an asc file. I want to convert it to a numeric array to make operations easier. I'm getting the error message: cannot support cell arrays containing cell arrays or objects. How can I fix this? Any help would be much appreciated.
for p = 1:length(sample);
eval(['fid=fopen(''../RawData/' sample(p).name '@' sample(p).acqo '.asc'');']);
d = fgetl(fid); % defines d as the first line of the file
date = d(end-8:end); % defines date as the 8th character from the end to the end
t = fgetl(fid); %defines...

**Cell Array: 'Double' and 'Cell' type sub-arrays**Howdy!
I'm a NooB, but am making strides. This is my first line casted to MATLAB Central!
I am presented with the following 1x45 cell array:
[double] [double] [double] {cell} [double] ... [double]
-- note the curly brackets around {cell}...why is that?
Every sub-array is a 1000x1 column vector. Cells 1-3, and 5-45 all contain numeric data. Cell 4, on the other hand, contains #NAME? and seems to be interpreted as a cell.
*** I would like to convert this cell array to a 1000x45 matrix. If all the sub-arrays were [doubles], then the function CELL2MAT would work perfectly. How...

**convert multi-element cell array to single cell array element**I wish to efficiently convert a number of elements contained in a cell
array to a single cell array element using carriage returns to
preserve the presentation of the contents. I know I can write a bunch
of code to achieve this but was hoping for slicker way. Thanks.
-Chris
for example, given ans as follows,
ans =
'' 'x < 0.0' 'T' '-'
'' 'Actions' 'A1' 'A2'
>> whos ans
Name Size Bytes Class
ans 2x4 520 cell array
I...

**How to delete row of empty cell arrays without reshaping of cell array?**Hi,
I am able to detect empty cells in a cell array. After deleting these cells the cell itself reshapes.
That's bad.
But I can't figure out how to delete whole rows of empty cells without reshaping of the original cell.
Would be nice if somebody could give me a solution.
I am sorry.
Kind regards,
Gudrun
In article <28303939.1204057966993.JavaMail.jakarta@nitrogen.mathforum.org>,
bluesaturn[at]kellnerweg.de <bluesaturn@kellnerweg.de> wrote:
>
>I am able to detect empty cells in a cell array. After deleting these cells the cell itself reshapes.
>That's bad...

**Masking char arrays from double arrays in a cell array**If we have a 3D cell array containing: (1) char-array cells
and (2) double-array cells, how could we "easily" mask out
either one or the other?
"Joh Yhan" <johyhan@aim.com> wrote in message
<fpkb5h$fno$1@fred.mathworks.com>...
> If we have a 3D cell array containing: (1) char-array
cells
> and (2) double-array cells, how could we "easily" mask
out
> either one or the other?
>
>
Take a look at cellfun and use logical indexing.
hth
Jos
Thanks Jos.
For everbody else below is a way of masking out non-doubles
to, in this case, z...