Answered
how to fill gaps in a matrix with a numbers using interpolation to develop a contour.
M(cumsum(M) & cumsum(M,1,'reverse')) = 3; or for: M =[0 0 0; 2 2 3; 3 3 0; 0 0 0; 3 3 0; 2 2 3; 0 0 0; 3 3 2; 0 0 0; 3 3 3]; ...

6 years ago | 1

| accepted

Answered
Delete rows with bad data and surrounding rows
ii - row indices with valid data (imdilate - function from the Image Processing Toolbox). ii = find(~imdilate(any(B,2),[1;1;1])...

6 years ago | 0

Answered
generate index for included subjects
temp.ids = 101:130; excl = 126:127; incl = ~ismember(temp.ids,excl); age = temp.age(incl);

6 years ago | 0

| accepted

Answered
How can I count specific value in one column but based on another four columns
Tout = varfun(@(x)numel(x),T,'g',1:4);

6 years ago | 1

| accepted

Answered
Mean value of equal cells
Let X - your cell array (2 x 9): out = mean(cat(1,X{2,:}));

6 years ago | 0

| accepted

Answered
From cell array to matrix
Y = cell2mat(cellfun(@(x)[x(:);zeros(4-numel(x),1)],X,'un',0));

6 years ago | 1

| accepted

Answered
Delete empty field - rows in a structure
out = Track_20(all(~cellfun(@isempty,struct2cell(Track_20))));

6 years ago | 7

Answered
[Help] If and ifelse condition
load('AC_Data.mat'); T = cell2table(AC); T.AC3 = str2double(T.AC3); T_out = fillmissing(T,'previous');

6 years ago | 0

| accepted

Answered
Reallocate values in matrix to even the values
n = size(Y); lo = ~eye(n); Y(lo) = max(Y(lo),5);

6 years ago | 0

| accepted

Answered
how to save double loop output in matrix form.
sm = conv2(thin_image,ones(3),'valid') imat = thin_image(2:end-1,2:end-1) == 1; ridge = sum(sm(:) == 1 & imat(:)); bifurcatio...

6 years ago | 0

Answered
How to use an array as an indexing table to add search result as a new row to the querying array ?
Q_new = [Q,Idx(discretize(Q,[Idx(:,1);Idx(end,2)]),3)];

6 years ago | 1

| accepted

Answered
How to create a matrix out of all the possible combinations of a vector
Please see answer by Roger Stafford. In your case: a = 3:5; v = [0,-1,1]; n = cumsum(a,'reverse'); C1 = nchoosek(1:n(1),a...

6 years ago | 1

| accepted

Answered
calculate area in table
T = readtable('Book1.xlsx'); out = varfun(@sum,T,'g','Class_Name');

6 years ago | 0

| accepted

Answered
Generating random variable from certain standard deviation and mean
a = .3;% standard deviation b = 0; % mean out = a.*randn + b;

6 years ago | 2

| accepted

Answered
Sub-Matrices in a bigger matrix
For matrices with the same size. Let [m,n] - size of each matrix, q - number of matrices in the vertical of a large matrix: M...

6 years ago | 0

Answered
For Loop Problem error
img=imread('C:\Users\Shalaw\Downloads\gray.jpeg'); [n,m]=size(img); imgs = mat2cell(img,[n,n]/2,[m,m]/2)'; for ii = 1:4 ...

6 years ago | 0

Answered
Calculate based on row
out = cellfun(@(x)-diff(x),your_cell_array,'un',0);

6 years ago | 1

| accepted

Answered
Creating dates tables with loop
dates = (datetime(2014,4,16,0,0,0):hours(1):datetime(2016,6,8,0,0,0))';

6 years ago | 1

| accepted

Answered
Problem in matrix dimension
T = readtable('fire_archive_M6_59116.csv'); a = T.acq_time/100; T.acq_date = T.acq_date + hours(fix(a)) + minutes(100*mod(a,1)...

6 years ago | 0

| accepted

Answered
how to get combination of elements in a matrix in pair order
A=[3 5 6 7 8]; [y,x] = ndgrid(A); B = [x(:),y(:)]; B = B(diff(B,1,2) ~= 0,:);

6 years ago | 0

Answered
how to loop in one time to get the max value minus the min value.
[a,~,c] = unique(cdata{1}(:,1:4),'rows','stable'); out = [a,accumarray(c,cdata{2},[],@(x)max(x) - min(x))];

6 years ago | 0

Answered
Checking for multiple values that are the same in a vector
C = C(:); d = [1;diff(C) ~= 0]; ii = cumsum(d); counts = accumarray(ii,1); k = find(counts >= 10); lo = ismember(ii,k); ...

6 years ago | 1

| accepted

Answered
Error when multiplying two vectors
Use .* and ./: Want=IWant.*lett+20./lett+1;

6 years ago | 0

| accepted

Answered
To equate one value to another?
May be like this: Let S - your signal. m = min(S); detph = 10/(max(S) - m)*(S - m) + 5;

6 years ago | 0

| accepted

Answered
Find and edit interval of array when element is equal to a value?
i1 = double(diff([A,0]) == -2); ii = find(i1) - 3; i1(ii(ii > 0)) = -1; out = cumsum(i1,'revers').*A

6 years ago | 1

Answered
how to store each ans which we get from loop in a 2-d array ?
Thin_image = single(rand(7) > .8); % for example out = conv2(Thin_image,ones(3),'valid'); ridge = sum(out(:) == 1); bifurca...

6 years ago | 0

Answered
Howe can I subtract neighboring numbers?
diff(z) z/60

6 years ago | 0

| accepted

Answered
Comparing two matrix elements summing third and storing them separately
[B,BB] = groupsummary(A(:,3),A(:,1:2),'sum'); out = [BB{:},B];

6 years ago | 0

Answered
How to generate a hankel and toeplitz array of blocks from three series?
A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ]; [m,n] = size(A); C = num2cell(A,1); ii = triu(toeplitz(1:n-1)); H ...

6 years ago | 0

| accepted

Answered
how can remove the rows and columns which has ones in all
A=[1 1 1 1; 1 0 1 1;1 0 0 1]; AA = ~A; B = A(any(AA,2),any(AA));

6 years ago | 0

Load more