Answered
Compute the product of the next n elements in matrix
[prodout, ind] = max_product(A,n) ii = 1:numel(A); ind = hankel(ii(1:n),ii(n:end)); prodout = prod(A(ind)...

9 years ago | 1

Answered
Filtering elements of a cell array and indexing
idx = find(cellfun(@(x)strcmp(x,chan_group_p1),groups));

9 years ago | 2

| accepted

Answered
Getting unique values of an excel sheet relying on one column only.
z = [1 2 3 4 5 1 3 5 6 4 2 3 5 7 4 3 4 1 5 4]; [~,b] = unique(z(:,end),'stable'); out = z(b,:);

9 years ago | 1

| accepted

Answered
How to Remove the values that exist in a cell from another cell.
ii = strfind(Head{4},Hf{3}); Head{4}(bsxfun(@plus,ii(2:end),(0:numel(Hf{3})-1)')) = [];

9 years ago | 1

| accepted

Answered
how can i use a vector coordinate as input in function?
function d = computeDistance(p1,p2) d = sqrt(sum((p1-p2).^2)); end

9 years ago | 0

Answered
Count and "synchronize" events in several columns
A1=A(:,2:end); A1= any(~isnan(A1),2); out1 = bwlabel(A1); out1(~out1) = nan; out = [A,out1]; or A1=A(:,2:...

9 years ago | 1

| accepted

Answered
Simple question about functions
function nFib = fib(n) a = (1 + sqrt(5))/2; nFib = a^n-(-a)^(-n) / sqrt(5) ; end

9 years ago | 0

| accepted

Answered
How to create triangle inside matrix?
sort(spdiags(toeplitz(1:n)))

9 years ago | 3

| accepted

Answered
how can I store values generated from a nested loop into an arrray ?
function S = triangle_wave(n) t = linspace(0,4*pi,1001)'; k = 0:n; S = sum(bsxfun(@times,sin(bsxfun(@tim...

9 years ago | 1

| accepted

Answered
how i can get all row of data from a table ??
Power_min_max(end,:)

9 years ago | 0

| accepted

Answered
How do I find list down values in a matrix that is larger than 0.75?
Like said Stephen Cobeldick: [ii,jj] = find(B > .75); out = [ii,jj];

9 years ago | 0

Answered
How to from a list produce a list of all distinct difference of elements and find out it comes from efficiently?
a = [1 2 3 16 27 39 78 88 98]; [ii,jj] = ndgrid(1:numel(a)); t = jj < ii; d = bsxfun(@minus,a(:),a(:)'); [a1,~...

9 years ago | 0

Answered
How to correct for loop?
A = [ 1 0 0 4 1 0 3 4 1 2 0 4 1 2 3 4]; D = [ ...

9 years ago | 1

| accepted

Answered
Creating specific vertical matrix
t = [100,600]; x = zeros(tmax,1); x(t(1):(sum(t)-1)) = -.0015;

9 years ago | 0

Answered
Vectorization in cell array assignment without nested for loop
n = size(c,2); [jj,ii] = ndgrid(1:n-1,1:n); ij = [ii(:),jj(:)]; t = diff(ij,1,2) == 0; ij(t,2) = ij(t,2) + 1; G...

9 years ago | 0

Answered
Assign to certain positions of an entire cell array values from another cell array of the same size
a_part {1} = [1; 2; 8]; a_part {2} = [11; 31; 15]; a_part {3} = [2; 4; 8]; a = zeros(numel(a_part{1})+2,numel(a_p...

9 years ago | 1

| accepted

Answered
saving Iterations in the loop below
Ro = 0.05:0.1:0.45; ii = 20*pi/180:20*pi/180:90*pi/180; BGammaMax = 0.5:0.1:3; phi2 = 0:2*pi/60:2*pi; a = cell...

9 years ago | 0

| accepted

Answered
Please can you give me some regular expression help
regexp('H970D80Dia4W19L19WT856','(?<=D)\d+','match')

9 years ago | 1

| accepted

Answered
How to average values in a structure
for your |data| (struct 1 x 960) x = 20; Q = struct2cell(data); m = size(Q); n = size(Q{1}); y = m(end)/x; a...

9 years ago | 0

Answered
How do I find the correlation coefficient between two vector arrays?
R = corrcoef(A,B) Please read about <http://www.mathworks.com/help/matlab/ref/corrcoef.html?searchHighlight=correlation%20c...

9 years ago | 3

Answered
i need to compare each value in cell with different rows for average filling method kindly guide me good technique
a = [2 5 3 nan 5 3 4 5 6 7 5 6 7 8 9 2 5 3 1 1]; t = ~isnan(a); [m,n] = size(a); [y,x] = ndgrid(1:m,1:n...

9 years ago | 0

Answered
Count occurrences of dates in an excel file
[~,~,dc] = xlsread('Orders.xlsx'); % T = readtable('Orders.xlsx'); z = dc(2:end,:); % z = tab...

9 years ago | 1

Answered
how to find maximum value in some specific group range of matrix
a = [3 2 5 6, 4 2 5 5, 5 2 5 3, 6 2 5 4, 7 2 5 1, 8 2 5 1, 9 2 5 3, 11 2 5 1, 2 3 8 6, 4 3 8 3, ...

9 years ago | 1

| accepted

Answered
How to assing incrementing numbers to identical values in a column?
M = [1990 1 .098;1990 1 .99;1990 1 .34;1990 2 .56;1990 2 .44]; [ii,jj] = unique(M(:,1:2),'rows','first'); [~,kk] = ...

9 years ago | 0

Answered
How to split 14400x1 into 20 719x1 matrices?
a - your vector; n = 719; m = numel(a); out = reshape([a(:);nan(mod(-m,n),1)],n,[]);

9 years ago | 0

| accepted

Answered
How to calculate the mean from cell when each cell is a different double.
*EDIT* m = numel(data); [ii,~]= cellfun(@size,data); a = nan(max(ii),size(data{1},2),m); for jj = 1:m a(1:i...

9 years ago | 1

| accepted

Answered
Min of each row of a matrix and their indexes
X=[11 13 15] Y=[43 45 47] Z = [27 25 21;35 38 37 ;42 47 49] [~,ii] = min(Z,[],2) out = [X(ii)',Y(:)]

9 years ago | 1

| accepted

Answered
how i average n values in array
a - your vector; out = movsum(a,[0 9],'Endpoints','discard')/10;

9 years ago | 0

Answered
having trouble with repetitive answers
t1=50; t2=25; q = 1:4; y = 9; [~,a] = sort(rand(y,t1),2); b = randi(t2,y,1); a = sort(a(:,1:3),2); x ...

9 years ago | 1

Answered
Replacing NaN with its succeeding values
A=[NaN NaN 1 1 0 0 NaN 0 NaN 1 1]; z = flip(A(:)); x = ~isnan(z); z = z(x); B = flip(z(cumsum(x)))';

10 years ago | 0

Load more