Answered
Please help with this
prod(2:2:10);

10 years ago | 0

Answered
HOW CAN I SORTED MY MATRIX DESCEND
M=[ 1 2 3 4 5 ;1 20 54 6 40]; [~,ii] = sort(M(2,:),'descend'); out = M(:,ii); or out = sortrows(M',-2)';

10 years ago | 0

| accepted

Answered
how to find the positions of a value or less than that value from a matrix????
[ii,jj] = find(A<=1)

10 years ago | 1

| accepted

Answered
3D interpolation on a table
>> f = fopen('yourdata.txt'); cc = textscan(f,'%f %f %f %f %f %f %f ','HeaderLines',2,'CollectOutput',1 ); fclose(f); ...

10 years ago | 0

| accepted

Answered
how Calculate the number of object(submatrix) in matlab?
sum(conv2(a,b) == 8)

10 years ago | 0

| accepted

Answered
Make a matrix from equation of vectors
alpha = 1:1:10; beta = 2:2:20; solution: y = bsxfun(@minus,3*beta',2*alpha); or m = numel(alpha); ...

10 years ago | 0

Answered
How to save the value in matrix
aa = abs(a); me = aa - dx; t = me < 0; mat_ele = sign(a).*me; mat_ele(t) = a(t);

10 years ago | 0

| accepted

Answered
How to select (and assign) values within a specific subregion of a matrix
use function |bwdist| from |Image Processing Toolbox| out = (bwdist(A,'chessboard')<3)*2-A;

10 years ago | 0

Answered
How to expand a vector by a different number of copies for each entry?
A=[1;2;3;4;5]; B=[2;1;3;1;3]; n = cumsum(B); idx = zeros(n(end),1); idx(cumsum(B)-B+1) = 1; C = A(cumsum(idx)...

10 years ago | 0

| accepted

Answered
How to fill values between two values.
A = [1 0 0 0 2 0 3 0 0 0 0 4 0 5]; t = A ~= 0; x = 1:numel(A); B = interp1(x(t),A(t...

10 years ago | 1

Answered
calculate equality between adjacent elements in matrix
B1 = diff(A,[],2)==0; B2 = diff(A)==0;

10 years ago | 0

Answered
Cumsum function + range of values after cumsum.
cmsum0 = cumsum(A); cmsum = rem(cmsum0-1,160)+1; delte = A; t = A > 0; delte(t) = cmsum(t);

10 years ago | 1

| accepted

Answered
Count specific values in a matrix and Find row and column number of the first value among consecutive same values.
s = [1 1 1 1 1 1 2 2 2 2 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 6 6 6 6 6 6 6 6 7 7 7 8 8 8 8 8]; 1) t = [true,diff(s)~=0];...

10 years ago | 1

| accepted

Answered
Hello,How ı should chose desired columns in a row in matrix?Thanks
out = A(:,2:5)

10 years ago | 1

| accepted

Answered
summation using while loop until I get a certain value
A=[3 4 10 3 9 10 12 4 11 9 11 10]; sum1=0; k=1; while sum1<43 sum1=sum1+A(k); k=k+1; end disp(sum...

10 years ago | 1

Answered
How do I get only the width and height?
bbox(3);

10 years ago | 0

Answered
Selecting rows based on criteria from previous row
c - your array [72 x 3] x = c(:,1) == 0; out = c([false;x(1:end-1)],:);

10 years ago | 0

Answered
Convert text cell to double
z = {'$88.10' '$83.01' '$80.22' '$80.22'}; out = cellfun(@(x)str2double(x(2:end)),z);

10 years ago | 0

| accepted

Answered
How can sort permutations.
A=[30 30 30 30 30 30 60 60 60 60 60 60 60 60 30 30 30 30 30 30]; A1 = A; A = A1 > 30; n2 = numel(A); b2 = nnz(A); ...

10 years ago | 1

| accepted

Answered
How to sort a table with conditions of pair of values
a = [1 2 3 4 1 2 8 10 4 5 7 9 2 3 6 4 1 2 4 7 2 3 5 3]; out = sortrows(a);

10 years ago | 0

Answered
Vector-Matrix multiplication along third dimension
B = bsxfun(@times,A,reshape(v,1,1,[]));

10 years ago | 2

| accepted

Answered
Multiply each column of cell array by column vector
A = cell(size(B)); for jj = 1:10 A{jj} = bsxfun(@times,B{jj},C); end

10 years ago | 0

Answered
Building a matrix with a for-loop
n = 5; out = zeros(n+2,4); out(1,2) = 35; out(1,3) = 26; for ii = 1:n+1 out(ii+1,2) = 18*out(ii,2) - 11*out...

10 years ago | 0

Answered
matrix to matrix of indices
A = rand(3); [ii,jj] = ind2sub(size(A),1:numel(A)); EDIT [ii,jj] = ndgrid(1:3); out = arrayfun(@(x,y)sprintf...

10 years ago | 0

Answered
How to detect a peak at a given location?
A = [400,192;...;410,204;...;420,188]; - your array. [ypeak,ii] = findpeaks(A(:,2)); xpeak = A(ii,1);

10 years ago | 0

Answered
sample (with replacement) random integers all range included
out = randi([0,m],n,1); t = 0:m; N = histcounts(out,[t,m]); l0 = N==0; if any(l0) [~,ii] = max(N); ...

10 years ago | 0

Answered
summation of valuse in nested loops
z = 3; ii = 10; jj = 20; k = 100; z2 = z^2; A = (z2+sin(1:jj)'*ones(1,k))*ii;

10 years ago | 0

Answered
How to find first two maximum number in the matrix
[a,~,c] = unique(A(:,1),'stable'); a0 = sortrows([c,A(:,2:end)],[1,-(2:3)]); i1 = bsxfun(@plus,find([1;diff(A(:,1))~=0])...

10 years ago | 0

| accepted

Answered
How to return the sequential number of nonzero and zero elements in a list?
B = reshape(diff([find([1;diff(A(:)>0)~=0]);numel(A)+1]),2,[])';

10 years ago | 0

| accepted

Answered
How do I extract data from a cell array?
cat(3,Outf.KELEM{:})

10 years ago | 0

| accepted

Load more