Answered
How to calculate the standard deviation (or other generic functions) of a 3D cell?
out1 = cellfun(@std,data) ; out = num2cell(out1,3);

9 years ago | 0

Answered
A very quick question
A = '1 0 0 1'; B = '1'; An = A - '0'; Bn = B - '0'; An = An(An >= 0); Bn = Bn(Bn >= 0); idb = find(B...

9 years ago | 0

Answered
Find minimum and create a new matrix
m = size(test_1,1); i0 = (0:22:m-1)'; ii = ceil((1:m)'/22); T = test_1(:,10); T(T == 0) = inf; idx_min = accuma...

9 years ago | 0

| accepted

Answered
There is a problem in loop. Could anyone please correct my code.
*[EDIT]* CNmat =... triu(squeeze(sum(adj.*permute(adj,[1 3 2]))).*~eye(size(adj,2)));%R2016b and later CNm...

9 years ago | 0

Answered
Create one vector from several iterations in for loop
n = 5; Latitude = [Lat(1);reshape(reshape(Lat(1:end-1),1,[])... + cumsum(ones(n,1)* ...

9 years ago | 0

Answered
Replacing the numbers in a matrix
Let A - your array [22 x 22] A(bwdist(A==0) <= 1) = 0

9 years ago | 1

Answered
Find an element in a matrix
[cols rows] = find (A.' == 1)

9 years ago | 0

| accepted

Answered
Delete rows based on column value
Let |A| - your matrix [8761 x 14] [m,n] = size(A); A1 = [A; nan(mod(-m,24),n)]; A1 = reshape(A1',n,24,[]); Aout = ...

9 years ago | 0

| accepted

Answered
How to produce a binary matrix from the original matrix
[m,n] = size(C); out = any(reshape(C,m,1,[])==(1:n),3)*2.^(m-1:-1:0)' + 1;

9 years ago | 0

Answered
I make mistakes while creating a matrix
Adog1 = sum((reshape([DNdog,BNdog],[],1,2) == blnmynokta(:)').*cat(3,1,-1).*aik0,3);

9 years ago | 0

Answered
I'm having a divide problem in matrices
P_out = P./s; or just P = eye(6)./s;

9 years ago | 0

Answered
How can I extract all matrix elements for one index with dynamic number of dimenstions?
ii = repmat({':'},1,ndims(A)-1); out = squeeze(A(1,ii{:}));

9 years ago | 1

| accepted

Answered
Matrix manipulation by function
ii = num2cell([1;1]*setdiff(1:length(A),B(:)'),2); out = A(ii{:});

9 years ago | 0

| accepted

Answered
how to use AND operation
Maybe so? if all(eucli >= 0.1980 & eucli <= 0.1990) disp('Happy'); else disp('Sad'); end

9 years ago | 0

Answered
Searching in cell arrays.
another variant m - file: function out = findrows(a,b) [~,ii] = ismember(a,b); [i1,~] = find(ii); out...

9 years ago | 0

Answered
How can i extrapolate a logspaced vector without changing my old vector?
V_main = logspace(log10(0.003),log10(0.25),30); V_add = logspace(log10(.25),log10(0.5),5); V_out = [V_main,V_add(2:end)]...

9 years ago | 1

Answered
how to determine row with all zero
row_all_zeros = find(all(adj == 0,2));

9 years ago | 5

Answered
How to chose random row which contain non-zero element
another variant inz = find(any(A ~= 0,2)); out = A(inz(randperm(numel(inz),1)),:);

9 years ago | 2

Answered
Finding row indexes in array
a=[0 0 1 0 ; 1 2 3 0; 1 0 3 4; 0 2 0 0 ]; b{1,1}=[4;3]; b{2,1}=[3;1;4]; v = 1:size(a,1); t = cell2mat(cellfun(...

9 years ago | 0

| accepted

Answered
Split Vector based on indices from another vector
x = 1:200; y=[20;50;120]; dy = 16; z = zeros(size(x)); z(y - 5) = 1; z(y + 10) = -1; z1 = cumsum(z); ...

9 years ago | 1

Answered
How do i combine many tables by respective column content?
Maybe so? Table_out = [A,B(:,2:end),C(:,2:end)]; *Added*: As said by Guillaume about |innerjoin|: A = readtable(...

9 years ago | 0

| accepted

Answered
How to Add custom Excel column values in Excel file based on conditional contents?
T = readtable('yourdataexcel.xlsx'); [~,~,c] = unique(T(:,1),'stable'); Tout = [T,table(c,'Variablenames',{'Label'})];

9 years ago | 0

| accepted

Answered
How do i select some columns that have maximum some values ?
T = readtable('data.xlsx'); dm = mean(T{:,2:end}); [~,ii] = sort(dm,'descend'); k = 2; % Let k = 2 Tout = T(:,[1,s...

9 years ago | 1

| accepted

Answered
delete dates from a matrix
A=[2004 6 18 13 8 0; 2004 7 19 13 45 2; 2004 8 18 13 8 13; 2004 8 18 13 9 41; 2004 9 18 13 9 50; 2005 1 20 13 1...

9 years ago | 0

| accepted

Answered
How to calculate the average columns values for a table in matlab ?
EDIT x = readtable('test.xls'); k = .002; t = varfun(@isnumeric, x,'OutputFormat','uniform'); x1 = x(:,t); ...

9 years ago | 1

| accepted

Answered
How Detect duplicate value in each column and replace one value with zero?
Aout = [true(1,size(A,2));diff(A)~=0].*A; or for matrix not sorted by columns: [m,n] = size(A); [A1,ii] = sort(...

9 years ago | 1

| accepted

Answered
I can not create a matrix
Maybe so? [~,ii] = ismember(BNdog,YON_BLNM) Zi = Z(ii);

9 years ago | 0

Answered
How can I implement the 3*3 matrix in a for loop?
x = (1:3)'; y = (2:4)'; z = (6:8)'; n = 5; m = numel(x); a = [x,y,ones(m,1)]; lhs = a.'*a; lhs(end) =...

9 years ago | 1

Answered
Is it possible to multiply a 3D matrix with a coumn vector?
C = reshape(reshape(permute(A,[2,1,3]),3,[]).'*B,3,[]);

9 years ago | 4

Load more