Answered
How can I divide a matrix in to vectors?
variant 1 Ccell = mat2cell(C,ones(size(C,1),1),size(C,2)); [C1,C2,C3,C4,C5] = Ccell{:}; variant 2 for jj = 1:siz...

15 years ago | 0

Answered
How can I plot a string function
ezplot('x^2+3*x+2+sin(x)')

15 years ago | 1

Answered
Problems with for loop
more Q = zeros(1,2*length(q)); Q(1:2:end) = q

15 years ago | 1

Answered
Is there a smarter way to create a large vector, with repeated numbers in a diminishing quantity?
n = 144; vm = triu(repmat(n+1:-1:1,n+1,1)); vm(vm>0);

15 years ago | 0

Answered
How do I find the boundaries of a value in a matrix?
more variant I1 = I == 8; l1 = [ones(1,size(I1,2)); diff(I1)~=0]; l2 = [ones(size(I1,1),1) diff(I1,1,2)~=0]; lud = [l1(2:end...

15 years ago | 1

Answered
convert matrix
A = rand(6,1) % array dimension 6x1 out = reshape(A,4,2);

15 years ago | 1

Answered
How do I avoid creating intermediate variables?
xy = [x f(x)]; out = xy(xy(:,1)>2&xy(:,2)>5,:)

15 years ago | 0

Answered
check cell's contents and convert to matrix
idx = find(cellfun('isclass',data,'char')); data(idx) = data(idx-1)

15 years ago | 1

Answered
Finding unique dates in vector
Date = ['02-Aug-2010 19:28:01' '13-Nov-2010 09:10:20' '10-Nov-2010 14:44:14' '02-Aug-2010 19:28:01' '08-Oct-2010 08:58...

15 years ago | 0

| accepted

Answered
Loop erasing random walk
EDIT V = v(:); [a b n] = unique(V,'first'); [~, bl, nl] = unique(V,'last'); v1 = [b bl]; v1(abs(diff(v1,[],2)) <...

15 years ago | 0

| accepted

Answered
How can I save line 1 in all images
I1=[1 1 1 0;1 1 1 0;1 1 1 0]; I2=[1 0 1 0;1 0 1 0;1 0 1 0]; In=[1 1 0 1;1 1 0 1;1 1 0 1]; variant 1 I = [I1 I2 In]...

15 years ago | 0

Answered
Finding the first 1 in indicator variable
out = find(A,1,'first') A - your indicator variable (vector) [outI,outJ] = find(A,1,'first') here A - your indicato...

15 years ago | 0

| accepted

Answered
change number of sig figs in a list of numbers
more (EDIT) N = 734504.0749692708 Ns = fix(N*100)/100 more more "I want to completely drop the last 8 figures in order to...

15 years ago | 0

Answered
estimation probability over the part of an array
function y=probability_estimate(x,m,s) y=mean(lognpdf(x,m,s)); end EDIT idxs = bsxfun(@plus,1:l,(0:length(x)-l...

15 years ago | 0

Answered
finding distance within a range of distance
ij5 = find(I==5); [i5 j5] = ind2sub(size(I),ij5); out1 = [nchoosek(ij5,2) bsxfun(@(x,y)sqrt(diff(nchoosek(x,2),[],2).^2......

15 years ago | 0

| accepted

Answered
Add a known column to a matrix 'n' times without a loop?
b(:,k:n) = (1:5)'*ones(1,n-k+1); more V = 1:5; b(:,k:n) = V(ones(1,n-k+1),:).'; more more b(:,k:n) = repmat(1:5,n-...

15 years ago | 3

| accepted

Answered
How to find repeated sequence , and the times of repeat, in array by Matlab?
variant A = str2num(num2str(12341212356)') N = length(A); out = cell(N-1,1); for j = 1:N-1 [a, ~, n] = unique(A(b...

15 years ago | 0

Answered
Cutting rows and columns from a matrix
B = zeros(sum(any(A,2)),sum(any(A))); B(:)=A(A~=0);

15 years ago | 0

Answered
Discrete equation with two unknown variables
f1 = @(x,x1,x2,y1,y2)[y1-x(1)*x1.^2./(1+x(2));y2-x(1)*x2.^2/(1./x(2))]; x1 = 1;x2 = 2;y1=10;y2=15; fsolve(@(x)f1(x,x1,...

15 years ago | 0

Answered
finding values common to 3 different single-column matrices
intersect(intersect(A,B),C)

15 years ago | 3

Answered
determining whether a number lies in any of the intervals of a 2 column matrix
K = min(B(:)):max(B(:)); idx = arrayfun(@(x)find(K>=B(x,1) & K<=B(x,2)),1:length(A),'un',0); out = A(ismember(A,K([idx{:...

15 years ago | 0

Answered
custom reshaping of multidimensional arrays
so? VNEW = permute(VOLD,[1 2 4 5 3]);

15 years ago | 1

| accepted

Answered
array addition
c(abs(c)<100*eps)=0

15 years ago | 0

| accepted

Answered
matrix array
variant A = [12 0 8 0 4 0 1 0 5 0 9 0 3 0 1 0 10 0 12 0 ... 2 5 4 7 6 9 8 11 2 3 6 7 10 11 1 2 3 4 5 6 7 8 9 10 11 12]...

15 years ago | 0

Answered
finding nearest distance of a distinct value
EDIT [Hi Hj] = find(I~=1); d = [Hi Hj I(I~=1) sqrt(sum(bsxfun(@minus,[Hi Hj],[3 4]).^2,2))]; ds = sortrows(d,4); d5 ...

15 years ago | 1

| accepted

Answered
want to convert cell to matrix
variant for j = 1:length(A) k = num2str(j); eval(['b' k '=A{' k '}']); end or [b1,b2,b3,...,bN] = A{:};

15 years ago | 0

| accepted

Answered
finding distance of distinct value
variant o34 = zeros(size(I)); o34(3,4)=1; o34d = bwdist(o34); distato34 = [I(I~=1) o34d(I~=1)] more variant o = [3 ...

15 years ago | 0

| accepted

Answered
Subtract combinations of variables in a vector
more variant (without Statistics Toolbox) [I J] = meshgrid(vec); Mdist = reshape(diff([I(:) J(:)],[],2),[],length(vec)); ...

15 years ago | 0

Answered
accessing surrounding elements in an array
variant Aout = A; Aout(2:end-1,2:end-1) = conv2(A,ones(3),'valid')/9; % or "8" and [1 1 1;1 0 1;1 1 1]? MORE EDIT 2 varia...

15 years ago | 0

Answered
matlab code for comparing intensity values of each pixel in two images and then creating third image
variant % "I" -> I1, "IF" -> I2 B = single(I1 >= I2);

15 years ago | 0

Load more