Answered
Extracting pieces of string data
out = regexp({A,B,C},'.*(?=_\d_I_CE)','match'); out = [out{:}]';

12 years ago | 0

| accepted

Answered
How can I count the occurrences of each element in a vector in MATLAB?
[a,b] = histc(x,unique(x)); y = a(b);

12 years ago | 11

Answered
how to get values of a matrix in MATLAB where the indices are given in a MATRIX form?
n = size(ASorted); APart = ASorted(sub2ind(n,Index,ones(size(Index,1),1)*(1:n(2))));

12 years ago | 1

| accepted

Answered
logical operators in if statement
about |&&| see <http://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html?searchHighlight=plot |here|>

12 years ago | 0

Answered
Get new variable if a condition verifies in a cell
Aw = cell2mat(A(:,[1,3,4])); x = unique(Aw(:,2)); n = numel(x); out = [2010*ones(n,1),x,nan(n,1)]; y = 2008:2010; ...

12 years ago | 1

Answered
Attempting a simple matrix value replacement. Could i get some help?
X = 0:0.1:4; Y = 0:0.1:4; [x,y]=meshgrid(X,Y); z = x.^2+y.^2; t = z<2; z(t)=y(t); grid on; contour(X,Y,z,...

12 years ago | 0

| accepted

Answered
Eliminate symbols from char to number
out0 = regexp('01-01-01','\d*','match'); out = [out0{:}];

12 years ago | 0

| accepted

Answered
Simple Linear Interpolation using Interp1
time = [1 2 3 4 6 7 8 10 11 12]; temp = [10 12 15 13 16 16 18 15 21 20]; points = [1 2 3 4...

12 years ago | 2

| accepted

Answered
Converting the format Row Column Value into matrix ?
A = [1 2 5 1 3 6 2 1 8 2 5 1 3 1 4 3 3 2]; out = accumarray(A(:,1:2),A(:,3))

12 years ago | 0

Answered
Sort cell according to one column of the cell
out = sortrows(A,[3,1]);

12 years ago | 9

| accepted

Answered
Append a column to a cell variable if two conditions verify
*EDIT* [l1,i1] = ismember(A(:,end),B(:,2)); l2 = ismember([A{:,1}]',[B{:,1}]'); l3 = l1&l2; A(l3,end+1) = B(i1(l3)...

12 years ago | 2

| accepted

Answered
Updating a matrix using a for loop and if clause. Causing expression to the left of the equals sign is not a valid target for an assignment.
add = [0.03125,0.015625,0.03125]; d1 = [0.5,0.25,0.5]; t = Seed0Orange == 100; n = nnz(t); data = zeros(3,5000...

12 years ago | 0

Answered
How can I delete repeated elements? (not unique!)
Output = Input([true,diff(Input)~=0])

12 years ago | 0

Answered
comparing values of two matrix
c0 = {'n','s'}; C = c0( 1+(A == B));

12 years ago | 1

| accepted

Answered
How to find position of value in matrix and write as another matrix
on Akmyrat's comment [B,~] = find(A(:,[1 3 2])); B = B';

12 years ago | 1

Answered
Calculate how often a 1 turns into a 0 or 1, and vice versa
a = [1 1 1 0 1 0 0 1; 1 1 0 1 1 0 1 0]; n = size(a)-[0 1]; da = diff(a,1,2); t = [ones(n(1),1) da] == 0; [r,~]...

12 years ago | 0

Answered
Substitute blank entries in a cell array by elements from a double matrix
c = cell2mat(A(:,4)); A(:,6) = num2cell(B(ismember(B(:,2),c),3));

12 years ago | 1

Answered
How to Shuffle some arrays of a matrix? (permutataion matrix considered)
n = numel(x); c = sort(randsample(nVar,2)); r = c(1)+1:c(2)-1; z = x(r); x(r) = z(randperm(diff(c)-1));

12 years ago | 0

| accepted

Answered
How to shuffle some arrays of a matrix?
a=[1 2 3 4 5 6]; n = numel(a); a(2:n-1) = a(randperm(n-2)+1);

12 years ago | 1

Answered
Get new variable based on a condition
M=[2008 1 1 2009 1 2 2010 1 34 1996 12 7 1997 12 11 1998 12 5 1999 12 5 ...

12 years ago | 1

Answered
how to create 2X10000 matrix using for loop in matlab
x0 = reshape(X,2,[]); x1 = [x0(1,:);-conj(x0(2,:))]; x2 = [x0(2,:);conj(x0(1,:))]; tX = [x1(:).';x2(:).'];

12 years ago | 0

Answered
mutual array between two matrix
k = [2, 7]; t = ismember(k,Y); if all(t) R = Z(~ismember(Z,k)); end

12 years ago | 0

Answered
Find unique combinations of double and character elements
[y0,~,ii] = unique(A(:,2)); [y,~,i0] = unique([cell2mat(A(:,1)),ii],'rows') F = [num2cell(y(:,1)),y0,num2cell(accuma...

12 years ago | 1

Answered
Very simple logical question
arrayfun(@(x)sprintf('%04d',x),1:1000,'un',0); or reshape(sprintf('%04d',1:1000),4,[])'

12 years ago | 1

| accepted

Answered
How can I perform modulus operation (mod)?
mod(8,10) mod(-3,10)

12 years ago | 0

Answered
working with multiple matrix avoiding "for"
k = 221; s = size(b,1); b2 = reshape(b,k,s/k,[]); variation = squeeze(std(b2,0,2)./mean(b2,2));

12 years ago | 0

Answered
How to sum data
s = unique(raw_headers); format_headers = cellstr((s{1}:s{end})'); [~,ii] = ismember(raw_headers,format_headers); for...

12 years ago | 0

Answered
how to use "or"
for ii = 1:100 if ii == 2 || ii == 5 ii disp('hallo') end end or for ii = 1:100...

12 years ago | 0

Answered
Add zeros to some dates
out = datenum(cellfun(@(x)sprintf('%06s',x),acyc{:},'un',0),'yymmdd'); right variant f = fopen('ki2_out_acyc.txt'); ...

12 years ago | 1

Load more