Answered
How do I find the duration of a number in an array?
c = c(:); ii = [true;diff(c)~=0]; i2 = diff([find(ii);numel(ii)+1]); [a,b,c0] = unique(c(ii),'first'); % in new v...

11 years ago | 0

| accepted

Answered
How to calculate the frequency of a binary event (0 or 1) on a weekday basis over the last 10 years?
t = datenum([2015 2 14;2015 8 15]); [N,S] = weekday((t(1):t(2))'); O = rand(numel(N),1) > .5; % ones out1 ...

11 years ago | 0

Answered
How to Subtract a matrix from another matrix of different size?
setdiff(a,b,'rows')

11 years ago | 3

| accepted

Answered
how to get the transpose of hexadecimal array from text file ..any code related this
f = fopen('your_text_file.txt'); c = textscan(f,'%s','delimiter','\n'); fclose(f); out = c{:}

11 years ago | 0

| accepted

Answered
how to make a function that take an integer as input and return ture if this prime otherwise false
function p = myprime(n) p = n-nnz(rem(n,1:n)) == 2;

11 years ago | 0

| accepted

Answered
Matrix Manipulation Image Processing
A = rand(100,2); % your matrix [~,ii] = sort(A(:,1)); out = A(ii,:);

11 years ago | 0

| accepted

Answered
Accept 2 numbers from user
a1 = 1 : 9; b1 = 0 : 9; c1 = 0 : 9; num1 = input('Enter num1 value: '); num2= input('Enter num2 value: '); ...

11 years ago | 0

Answered
how to cell array data in single matrix
out = cat(1,c{:});

11 years ago | 0

| accepted

Answered
Making Matrices with Loops
bsxfun(@minus,((10*n+n):-10:10)',0:n-1)

11 years ago | 0

Answered
Converting values to 0 and 1 and then counting occurrences!
out = numel(strfind(A(:)' >= 20,[1, 0]));

11 years ago | 1

Answered
Extract a matrix out of another matrix with logiccal expression
Your homework? out = []; for jj = 1:size(F,1) if F(jj,1) >= 5 out = [out; F(jj,:)]; end end ...

11 years ago | 0

Answered
Create a vector with known indices and assign to that values from known vectors
var = [ 5 6 7 8 9;11 12 13 14 15;17 18 19 20 21]; pts = [1 1 3 2 2]; [m,n] = size(var); out = var(sub2ind([m,n],p...

11 years ago | 1

Answered
Combining two vectors of different elements in an order
mn = sort([n(:)',m(:)']);

11 years ago | 1

| accepted

Answered
finding Missing elements in a vector
out = P([1;diff(P)] < 0);

11 years ago | 0

Answered
findout the repeating element and the no of time of repeated in a matrix
A=[1,2,3,4,5,5,6,7,8,8,8, 9] a = unique(A); b = histc(A,a); t = b > 1; repeatvalues = a(t); Nooftimerepeat...

11 years ago | 0

Answered
Combining two arrays question
loc1 = permute(struct2cell(data),[3,1,2]); Loc = arrayfun(@(ii)[loc1{ii,:}],(1:size(loc1,1))','un',0);

11 years ago | 0

Answered
Cellfun: check cell array for any value below 5, if yes return true
any(cellfun(@(x)x < 5,A)) or any([A{:}] < 5)

11 years ago | 1

| accepted

Answered
how to separate odd and even elements of a matrix with out using for or while loops.
t_odd = rem(A,2) ~= 0; namber_odd = A(t_odd); namber_even = A(~t_odd);

11 years ago | 1

| accepted

Answered
how to group rows by date
[~,~,z] = xlsread('20150523.xlsx'); c = z(cellfun('isempty',regexp(z,'\'))); [y,~] = datevec(c); [~,~,c0] = unique(y)...

11 years ago | 1

| accepted

Answered
Get elements of a matrix that are greater than sum of their two indices in row major order
a = [1 4; 5 2; 6 0]; % your data n = size(a); [x,y]=ndgrid(1:n(1),1:n(2)); [ii,jj] = find(a > (x + y)); out = ...

11 years ago | 1

Answered
calculate the frequency of element in a matrix
matrix1 = [1 1 1 1 4 5 5 7 14 14 14 14 14 15 15 15 17 17 ; 2 6 7 7 7 2 3 5 2 3 4 5 6 3 4 4 3 6 ; ...

11 years ago | 1

| accepted

Answered
Matrix with Bell Triangle
n = 5; a = zeros(n); a(1) = 1; for jj = 1:n-1 a(jj+1,1:jj+1) = cumsum(a(jj,[jj,1:jj]),2); end

11 years ago | 2

Answered
how can I delete the matching rows of two matrices?
B = setdiff(R,C,'rows')

11 years ago | 1

| accepted

Answered
Updating numbers to be in sequential order
a = [1 1 2 2 3 1 2 3 3 4 1 1 2]; z = [0 3 7]; out = z(cumsum(diff([0,a == 1]) == 1)) + a;

11 years ago | 0

Answered
Interpolating measured data, by specific function
Please try it: fm = @(B,C,D,E,x)D*sin(C*atan(B*x-E*(B*x-atan(B*x))); F = fit(x,y,fm,'StartPoint', [1,1,1,1]); exa...

11 years ago | 0

Answered
i need a program in matlab..??
a = [92.5,95.2,95.8,95.9]'; x = randi(225,15,1); [~,ii] = histc(x,[0,57,113,169,225]); out = x.*a(ii);

11 years ago | 0

Answered
Interpolation of data that depends on two variables
[y,x] = ndgrid(unique(alpha),unique(sigma)); v = reshape(C,size(x)); f = griddedInterpolant(x,y,v); example of us...

11 years ago | 0

Answered
how i can find index of each element
Only in your case: [~,ii] = sort(Ex_BWLasColum);

11 years ago | 0

| accepted

Load more