Answered
how to reverse a matrix from bottom to top row wise and then pick out odd rows?
A =[10000 00010 10101 10011 10000 00001]; A = num2str(A); b =...

13 years ago | 0

| accepted

Answered
calculate mean of a vector
out = mean(vect);

13 years ago | 0

| accepted

Answered
Write a date loop in matlab
d = [19261103; 20121231]; ddte = datenum(num2str(d),'yyyymmdd'); ndte = (ddte(1):ddte(2))'; t = weekday(ndte); n...

13 years ago | 2

Answered
combination of numbers which is not in matrix form
A=[1 6]; B=[2 3 4]; C=[8 9]; Use function |fullfact| from |Statistics Toolbox|. for your case: t = {A,B,C}; k = ...

13 years ago | 0

Answered
Calculate Sn (like median absolute deviation) using matlab.
s = [3 1130; 4 1527; 3 907; 2 878; 4 995]; k = permute(abs( bsxfun(@minus,s,permute(...

13 years ago | 0

| accepted

Answered
i need to code for neighboring pixel
i1 = imdilate(A,ones(3)); l1 = find(A==0); i2 = i1(l1); A(l1(i2 == 255)) = 127;

13 years ago | 0

Answered
Create a new matrix from a mapping process
Vin = {'A' 'B' 'B' 'C' 'A'}; return1 = [Vin{:}] - 'A' + 1; or KS = {'A','B','C'}; VS = [1:3]; Vin = {'A'...

13 years ago | 0

| accepted

Answered
Identify an array of arbitrary minimum values. Alternatives to min / find ?
eg: tolerance = 1e-3; ii = abs(Vector - arbitrary_value) < tolerance; Value = Vector(ii); index = find(ii); ...

13 years ago | 1

| accepted

Answered
matrix value in broyden's method
jac(x) = jac(x) + (y - jac(x)*s)*s.'/(s(:).'*s(:)); or jac(x) = jac(x) + (y - jac(x)*s)*s.'/norm(s).^2;

13 years ago | 0

Answered
merging two matrices (cell matrices)
C = zeros(size(A).*[1 2]); C(:,1:2:end) = A; C(:,2:2:end) = B;

13 years ago | 0

Answered
Check max value of an array against a constraint
max(a(a<1)); and index of the location a1 = a; a1(a1<1) = -inf; [value,i1] = max(a1(:)); [ii,jj] = ind2sub(si...

13 years ago | 0

| accepted

Answered
How can I generate a Matrix (4x4) with random different figures from 1 to 4 ?
n = 4; A = rem(bsxfun(@plus,1:n,(0:n-1)')-1,n)+1; or [EDIT] A = hankel(1:n,[n 1:n-1]); A = A(randperm(n),:); ...

13 years ago | 0

Answered
Help with a function in a loop
function [s1, f] = ngramsfreq(str,n) n1 = numel(str) - n + 1; s1 = str(hankel(1:n1,n1:n1+n-1)); [s1,~,c] ...

13 years ago | 0

| accepted

Answered
How to make the same length of number?
ii = [true,diff(gb)~=0]; g = [gb(ii);diff(find([ii,true]))]; g1 = g(:,g(2,:)>1); [a,b,c] = unique(g1(1,:)); w = ac...

13 years ago | 2

Answered
assigning to vectors within bsxfun
Z1 = bsxfun(@plus,Z(1:op:op*max(Y)),M(:).'); s = size(Z1); Z2 = zeros(s); Z2(sub2ind(s,Y,1:s(2))) = 1; x = Z1.*fli...

13 years ago | 1

Answered
how to creating new matrix which is the variables come from 2 different matrix..?
C = permute(cat(3,A,B),[2 3 1]) in cell array Ccell = reshape(num2cell(C,[1 2]),[],1); with |for|-loop C2 = ce...

13 years ago | 0

| accepted

Answered
Matrix operation without for-loop
q = reshape(1:6,[],2); % let your vectors as [q1,q2] s = size(q,1); Q = bsxfun(@times,reshape(q,s,1,[]),reshape(q,1,...

13 years ago | 0

| accepted

Answered
Return to the start of a loop
str = 'abcad' ; n=3; out = str( hankel(1:n,n:numel(str)) ); without |hankel| out = str( bsxfun(@plus,1:n,(0:n...

13 years ago | 0

| accepted

Answered
Find for each value of a vector
v = max(bsxfun(@times,bsxfun(@ge,X(:),Y(:)'),1:numel(Y))),[],2);

13 years ago | 0

Answered
How to accumulate values into a variable using for loops?
Y = cumsum(conv(X,[1 1]/constant,'valid'));

13 years ago | 0

Answered
How do I create this vector: [10,8,10,8,10, ...]?
repmat([10 8],1,100)

13 years ago | 1

Answered
counting without built in function?
out = histc(a,[b(:,1)',b(end)])

13 years ago | 0

Answered
check a null value
att={'strong',[],'wind',[],'overcast','weak',[]}; t = cellfun('isempty',att); example a1 = att; a1(t) = {0}...

13 years ago | 0

Answered
how to write a matlab prog. for the exp. z(t)=y^3 where y=x when 0<=t<=1 ; y=3*x when 1<t<=2.
k = [0 1 3 0]; [j1,j1] = histc(t,[-inf,0,(1:2)-eps(100),inf]); z = (k(j1)*x).^3;

13 years ago | 0

Answered
Problem when using solve, do I need a different function
ff=matlabFunction(eq1); out = fzero(ff,6);

13 years ago | 1

Solved


sinus function
x is the abscissa. find the absolute value of cosine of -x and the same value with changed sign.

13 years ago

Solved


Find the function 2
Given a set of point (x,y) and the coordinate x of a new point, find the y value of new point. Test Suite is based on only one ...

13 years ago

Solved


only input
Return the output without writing any code into the function.

13 years ago

Solved


subtract central cross
Given an n-by-n square matrix, where n is an odd number, return the matrix without the central row and the central column.

13 years ago

Solved


frame of the matrix
Given the matrix M, return M without the external frame.

13 years ago

Load more