I have a string: pairs = ['AA';'AB';'BB';'AC'; 'CC'; 'CB';'DE'; 'BC'] How can I delete the element which has the same characters in its string like 'AA','BB', 'CC' ? The expected output should be: out = ['AB';'AC';'CB';'DE';'BC'] --------------Soluti
I have two cell arrays. One is 'trans_blk' of size <232324x1> consists of cells of size <8x8> and another 'ca' is of size <1024x1> consists of cells of size <8x8>. I want to compute mean square error (MSE) for each cell of 'ca' wit
I have an cell-array of dimensions 1x6 like this: A = {'25_2.mat','25_3.mat','25_4.mat','25_5.mat','25_6.mat','25_7.mat'}; I want to read for example from the A{1} , the number after the '_' i.e 2 for my example --------------Solutions------------- U
I have a cell array of size 5x5 as below B= 00 10 11 10 11 01 01 01 01 11 10 00 01 00 01 10 10 01 01 11 10 10 10 00 10 And two column vectors S1= 21 23 28 25 43 S2= 96 85 78 65 76 I want to create a new cell array of the same size as B say 5x5 such t
This question already has an answer here: Matlab array of char to string 2 answers say I have an array of chars which looks like.... hello hillo hello and I would like to convert them to a cell array which would be the same as... A = {'hello';'hillo'
Suppose I have a cell array like the following: mycell = [-1.6411e-16 + 1.4863e-19i] [ 0.6450 + 0.6433i] [ 0.6450 + 0.6433i] [-1.6411e-16 + 1.4863e-19i] I want it to be a matrix, so I use the command cell2mat: >> mymatrix = cell2mat(mycell) mym
I am using MATLAB to get output from a tracking device for gloves. I basically have: read = fgets(tracker); tic k = 1; while ischar(read) read = fgets(tracker); toc k = k+1; end I want to take 'read', which is a string, and save it with a time stamp
I am new to Matlab and was trying to concatenate array from cell arrays. I have done it as shown below. S = load('input_file.mat'); c = struct2cell(S); v = cell2mat(c(1,1)); temp = v(1:500,1:600); v = cell2mat(c(3,1)); temp1 = v(1:500,1:600); v = cel
How to append a column of strings to a column of numbers in MATLAB? For example, I have the string column wrds and the number column occurs wrds={'the' 'of' 'to' 'and'}'; occurs=[103 89 55 20]'; And I want to put them side by side so that they displa
I'm looking for a fast way to evaluate whether any element of a cell array contains the logical value false. For matrix arrays there is the convenient function all which is not working for cells. I have a hard time to implement the same function for
'' [ 2281] [ 2520] [8] '' [] [] '' Like above data in my cell array. How do I determine the second row is invalid? I tried isempty(), but the result is not optimal. --------------Solutions------------- Use cellfun and all along columns with isempty a
This is related to the post display all elements in a nested cell array (with character entries) with a change where entries are characters. A new question was asked for clarity. Now : a = {1x10 cell} {1x10 cell} {1x10 cell} {1x10 cell} a{:}= ans = [
I have the following: a = {1x1 cell} {1x1 cell} {1x1 cell} {1x1 cell} where: a{:} ans = 'a' ans = 'a' ans = 'c' ans = 'a' I want to have the characters: a a c a Since I need the characters to print using fprintf fprintf won't accept a{:} If I do a{1}
I want to produce a cell array as below in matlab: P= {100;010;000;000;001} {100;000;010;000;001} {100;000;000;010;001} {000;100;010;000;001} {000;100;000;010;001} {000;000;100;010;001} where P= {5x3 cell} {5x3 cell} {5x3 cell} {5x3 cell} {5x3 cell}
What is the difference between accessing elements in a cell array using parentheses (()) and curly braces ({})? For example, I tried to use cell{4} = [] and cell(4) = []. In the first case it set the 4th element to [], but in the second case it wiped
I have the following string in MATLAB: contents = '{'aa' 'bb' 'cc' 'dd'}' I need to get the 1x4 cell-array inside it, like: mycell = {'aa' 'bb' 'cc' 'dd'} How would you do it? Is there a quicker way than parsing it? --------------Solutions-----------
Is there built-in functionality for this? --------------Solutions------------- Yes check this: http://www.obihiro.ac.jp/~suzukim/masuda/octave/html3/octave_36.html#SEC75 a = ["hello"; "world"]; c = cellstr (a) ⇒ c = { [1,1] = hello [2,1] = world }
I have a matrix (call it X) that is initialized to say zero(3). I want to change the code so that X is a cell array of size (say) (3,1) and initialize each element to zero(3). I can do it with a loop but is there a better way? X = cell(3,1); for ii=1
I would like to plot connected points in MATLAB. My connected points come from connecting objects of "stats", where each "stat" comes from a BW regionprops struct. The code I have written works, but it suffers from a lot of "ugliness", which I couldn
Let's say I have the cell array strs = {'HA' 'KU' 'LA' 'MA' 'TATA'} What should I do if I want to find the index of 'KU'? --------------Solutions------------- I guess the following code could do the trick: strs = {'HA' 'KU' 'LA' 'MA' 'TATA'} ind=find