**cat applied to cell array**Hello,
I have a cell array of strings,g, that is 10-by-3, and I
wish to have a cell array of strings that is 10-by-1. The
'rows' of h should be the concatenated strings in g. This
works for what I want:
for ii = 1:length(g),h{ii} = [g{ii,1},g{ii,2},g{ii,3}];end
But is there a way to do this without a loop? I tried
cellfun with @cat, but I cannot pass the dim arg to cat (why
oh why?)
Thanks.
In article <fiphm2$1tr$1@fred.mathworks.com>,
Matt Fig <spamanon@yahoo.com> wrote:
>I have a cell array of strings,g, that is 10-by-3, and I
>wish to have a cell array of...

**Applying strncmp on cell array**I would like to extract the strings that match between two cell arrays of strings using strncmp to only compare strings on the length of strings in the second argument:
idxSites = strncmp(lstSites, IDVar, length(IDVar));
but length(IDVar) gives me the number of strings (771) while size(IDVar) returns 771 1. How can I properly extract the string length specific to each string in the cell array and thus make strncmp work?
--
Luc Le Blanc
On 3/19/2014 2:00 PM, Luc Le Blanc wrote:
> I would like to extract the strings that match between two cell arrays
> of strings using str...

**apply dual filter to cell array**Hello,
I have a 4x7 cell array where each cell contains 1000 rows of data.
I need to apply a 2nd order butterworth dual low pass (6hz) to each cell... and aviod changing to a matrix.
I am using [b,a] = butter(2,6/500,'low') to get my coefficients but then I don't know how to apply these in the filtfilt function for my cell array.
Any help will be much appreciated!
Thanks,
Teresa
"Teresa " <tflax005@uottawa.ca> wrote in message <hd9qah$of8$1@fred.mathworks.com>...
> Hello,
>
> I have a 4x7 cell array where each cell contains 1000 rows of data.
...

**Append new cells on an existing array**Hello there!
I've got a cell array call test:
>> test={'a';'b'}
test =
'a'
'b'
Now I want to append another Element called 'c', so that it looks
like
test =
'a'
'b'
'c'
At the moment, I'm doing it like this
>> test{length(test)+1}=['c']
But I'm looking for another way, like appending new elements to an
vector
>> test=[test; 'c']
But this isn't working yet. I tried several forms of writing, but
eve...

**error:non-existent element of a cell array**hello!
When i am using regexp, it gives me error that says "non-existent element of a cell array".
What can be reason to get this error message!
i used the regexp to extract concerning part from the *.dat files, and it worked. But now, i am trying to do the same processing with the same code by regexp in different but same structured file. Unfortunately, it gives me error which i wrote above.
If anyone help me to solve this problem, it will be very great contribution to my work.
best regards..
emine
...

**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...