Answered
How to find a vector in a matrix?
s = size(B) - 1; n = size(A) - s; out = []; for ii = 1:n(1) i1 = ii : ii + s(1); for jj = 1:n(2) ...

13 years ago | 1

Answered
replace missing value in a matrix using intropolated values
one way t = ~isnan(A); [x,y] = find(t); F = TriScatteredInterp(x,y,A(t)); [ii,jj] = ndgrid(1:size(A,1),1:size(A,2)...

13 years ago | 0

Answered
how can i get output
if x = [43 3 0 10]; % double array y = x*10.^(6:-2:0);

13 years ago | 0

Answered
how can i get output
y = str2num(sprintf('%d',x));

13 years ago | 0

Answered
how can i get output
s = '391632'; out = str2double(mat2cell(s,1,[2 4])); or a = s - '0'; out = [polyval(a(1:2),10), polyval(a(3:...

13 years ago | 0

Answered
How to add arrays to specific rows of a matrix in single step ?
a = randi(9, 10, 4); b = 100*ones(1, 4); rs = [2 5 7 9]; a(rs,:) = bsxfun(@plus,a(rs,:),b);

13 years ago | 0

| accepted

Answered
maximal subset N of binary matrix
M = rand(200) > .95; % your binary matrix out = M(sum(M,2) > 10,:);

13 years ago | 0

Solved


matrix zigzag
Unfold a 2-D matrix to a 1-D array in zig-zag order, e.g., for matrix [ 1 2 3 ; 4 5 6 ; 7 8 9 ] the resulting 1-...

13 years ago

Solved


Reference Index Number
Given a reference set R of elements (each unique but identical in type), and a list V of elements drawn from the set R, possibly...

13 years ago

Answered
this code is not working for transition probability matrix ....make it correct?
p1h = zeros(9); for ii = 1:9 p1 = Yh(1:end-2,:) == ii; for jj = 1:9 p2 = Yh(2:end-1,:) == jj; ...

13 years ago | 0

Answered
how to compare each element of matrix?
t = 4; f = [1 2 3 4; 2 3 4 5 ; 5 6 7 8 ; 1 2 3 5]; out = abs(f - t) < eps(100) ADD out = f; out(f <= t) ...

13 years ago | 0

| accepted

Answered
how to view the matrix in 2 dimension of the following values
d = randi(1000,5,486,586); % your array out = reshape(d,size(d,1),[]); %the horizontal orientation or d1 = num2...

13 years ago | 0

Answered
how to give a matrix index value from negative?
a = -4:4; a(1) for prasanna comment su=4; sv=4; fh=[1 2 3 4; 2 3 4 5 ; 5 6 7 8 ; 1 2 3 5]; t = -4:4; n ...

13 years ago | 0

| accepted

Answered
use "for loop" for n times but n is not fixed
v = 1:5; n = 3; a = cell(1,n); [a{:}] = ndgrid(v); out = cell2mat(cellfun(@(x)x(:),a,'un',0));

13 years ago | 1

Answered
Sorting and Saving a subset from the array
a0 = {16 1232 56 16 3455 56 16 5443 76 16 1232 88 17 4545 65 17 3432 87}; a = cell2mat(a0); [b,~,c] =...

13 years ago | 0

Answered
[MATLAB] I need any help for this problem
M = {Mat1,Mat2,Mat3}; M1 = cat(1,M{:}); n = cellfun(@(x)size(x,1),M(:)); n1 = [0;cumsum(n)]; n2 = zeros(n1(end),1)...

13 years ago | 0

Answered
How to make combinations of given condition?
k = dec2bin(0:sum(pow2(0:4)))-'0'; out = 2*k(sum(k,2) == 2,:);

13 years ago | 1

| accepted

Answered
Short question: Using the find command
[~,g1] = unique(X(:,3),'first'); G = sort(g1);

13 years ago | 0

Solved


Simple return on investment
Assume you have some money and want to invest all your money to stock market. You randomly select a stock and invest all your mo...

13 years ago

Solved


Reverse the elements of an array
Reverse the order of elements in an array: eg: input X = [ 1 2 3 ; 4 5 6 ; 7 8 9 ] o...

13 years ago

Solved


Get ranks of values in a vector
For a given vector, say [6 3 8 2], return the ranks (ascending) of observations, i.e. [3 2 4 1]. Do not worry about tied ranks. ...

13 years ago

Solved


Volume difference between Ellipsoid and Sphere
Given an ellipsoid of semi principal axis (a,b,c) find the volume of the difference between this ellipsoid and the sphere with...

13 years ago

Answered
defining a vector with vector of indices
A(B) = C; here C - with |size(C) = [1,1]| or |numel(C) == numel(B)|

13 years ago | 1

Answered
Can anyone please help me to understand the problem here? I keep getting the error "Index exceeds matrix dimensions".
if size(circles,1) == size(peaks,1) dc = cellfun(@(f)f(ang).*peaks(3,circles(:,1) & peaks(:,2)),{@cos,@sin},'un',0); ...

13 years ago | 0

Answered
a=rand(400), this function generates 400*400 random matrix a,how could generate matrix a with specified mean and variance.
|m| - your mean |s| - your variance |size_matrix| - size of your array < a x b > , |size_matrix = [a,b]|; fun1 = @(m,...

13 years ago | 1

Answered
solving simple equations in matlab
dat = d1.'*(.1./d2);

13 years ago | 1

| accepted

Answered
Is there faster way of computing loop; max(w .* x); pool; ?
r = max(bsxfun(@times,reshape(w',size(w,1),[]),reshape(x,1,size(x,2),[])),[],3); or r = max(bsxfun(@times,permute(w,[2...

13 years ago | 0

Answered
how to delete repated rows with out re order them
out = unique(levelx,'rows','stable');

13 years ago | 1

Answered
All the posible combination of two matrices
C = []; for j1 = 1:numel(B) a = nchoosek(B,j1); C = [C;num2cell([repmat(A,size(a,1),1),a],2)]; end

13 years ago | 0

| accepted

Load more