Answered
xor function
A = {'010','110','111','011'}; A1 = cellfun(@(x)x-'0',A,'un',0); vertxor = rem(sum(cat(1,A1{:})>0),2); or: A =[....

14 years ago | 0

Answered
Solving Ax=B where B is symbolic and x unknown?
eg: A = rand(8); b = sym('b',[8,1]); x = vpa(A\b,5); *ADD* on Walter's comment: for jj = 1:8 b(jj) = ...

14 years ago | 0

| accepted

Answered
Neighborhood operations of the image
try function |conv2| eg: |I| - your array |[m n]| - size your sliding window solution: out = conv2(I,ones([m n]...

14 years ago | 0

Answered
argmin function
norm(A(:),-inf) OR: min(A(:))

14 years ago | 0

Answered
switch statement help
in your case eg: c = randi([1 5],10,1); pt = [[190;120;890;1210;1990],[2;4;6;4;8]]; Tc = pt(c,1); Pc = pt(c...

14 years ago | 0

Answered
Create a array of 1 and -1
use function |ff2n| from |Statistics Toolbox| out = ff2n(4)*2-1; OR: out = unique(nchoosek((-1).^(1:8),4),'rows');...

14 years ago | 1

| accepted

Answered
Data
sign(diff(P));

14 years ago | 1

| accepted

Answered
removing element from all arrays in cell array of 1-dimensional arrays
newout = cellfun(@(x)setdiff(x,k),out,'un',0);

14 years ago | 1

| accepted

Answered
a problem with conditions and deleting rows
out = tab(ismember(tab(:,1:4),codename_station,'rows'),:)

14 years ago | 0

| accepted

Answered
average distance between column values in a matrix
use function |regionprops| from |Image Processing Toolbox| x =[... 1 0 1 1 1 1 0 0 0 ...

14 years ago | 0

Answered
how to find the variance of each row in a matrix?
out = var(X.').'

14 years ago | 1

Answered
Finding 2nd minimum value in an array
A2 = sort(A(:)); out = A2(2); other way: A2 = unique(A(:)); out = A2(2); or: out = min(setdiff(A(:),mi...

14 years ago | 7

| accepted

Answered
avoiding for loop
out = B + sign(B - A).*A; EDITED on Jan's comment out = (B~=A).*B + sign(B - A).*A;

14 years ago | 2

Answered
How to recognize lowercase letters in character recognition using MATLAB??
use regexp(yourstring,'\w*') regexp(yourstring,'[a-z]')

14 years ago | 0

Answered
How to round the decimals?
use |roundn| from |Mapping Toolbox| roundn(X,-2)

14 years ago | 1

Answered
How to put the values into the specific location?
A = zeros(4); location =[... 1 2 1 4 2 3 4 2]; Values =[... 55 22 99 11]; ...

14 years ago | 1

| accepted

Answered
how to efficiently find the indices?
[uM,n,n] = unique (M(:)); I = accumarray(n,1:numel(n),[],@(x){sort(x)});

14 years ago | 1

Answered
Need command help for a specific matrix operation
A(2:3,:).^2

14 years ago | 1

Answered
Replace 'greater than' values in a matrix
M - your matrix M(M > a) = b;

14 years ago | 34

| accepted

Answered
Output of numbers
>> d = .4; >> format short g >> d d = 0.4 >> format short e >> d d = 4.0000e-001 >>

14 years ago | 0

Answered
Multidimensional Indices of Multiple pages
id12 = [1 3; 4 5]; out = g1(bsxfun(@plus,bsxfun(@minus,id12,[0 1])*[1;size(g1,1)],(0:size(g1,3)-1)*prod(size(g1(:,:,1)))...

14 years ago | 0

| accepted

Answered
functions
infr = @(x)[fix(x),rem(x,1)] or: function [in, fr] = infr(x) in = fix(x); fr = rem(x,1); end

14 years ago | 0

Answered
How to generate a date vactor of weekly intervals.
out = datenum(2012,3,31+ (0:7:7*99)',0,0,0);

14 years ago | 0

Answered
reading from txtfile
N = regexp(names,'\w*(?=(.{1,3}\[))','match')'; tst = ~cellfun('isempty',N); clr = reshape(lookup,3,[])'; out = [cell...

14 years ago | 0

Answered
removing for loop by using cellfun
Data = cellfun(@(x,y)arrayfun(@(jj)mean(x(jj,1:y(jj))),1:length(y)),temp,bin,'un',0);

14 years ago | 0

| accepted

Answered
Extracting numbers from Text document
regexprep(str,str,'5')

14 years ago | 0

Answered
How to find a element in cell array
out = cellfun(@(x)regexp(x,'4'),s,'un',0); ADDED on Nguyen's answer :) out = cellfun(@(x)regexp(x,'^4$'),s,'un',0) ...

14 years ago | 1

| accepted

Answered
Small Problem with 'if' statement and array index
if isequal(Seg_Out_1(1,:),otherCellArray)

14 years ago | 0

Answered
How can I delete array rows with same numbers
[b b]=unique(sort(X,2),'rows','first'); out = X(sort(b),:)

14 years ago | 0

Answered
arrange indices
[ii,ii] = sort(r(3:3:end)); out = reshape(r(bsxfun(@plus,ii*3,(-2:0)')),1,[]); OR: out = reshape(sortrows(reshape(r...

14 years ago | 1

| accepted

Load more