Beantwortet
Extract fixed length arrays from each row of a matrix and build new matrix made of them
for MATLAB >= R2016b [m,n] = size(A); B = A(m*((0:n-2) + rem((1:n)-1,2)') + (1:m)');

mehr als 8 Jahre vor | 1

Beantwortet
Finding average of every nth row?
Let A - your array (9985 x 1). out = splitapply(@mean,A,ceil((1:numel(A))'/6)); or out = accumarray(ceil((1:numel(A...

mehr als 8 Jahre vor | 2

Beantwortet
How many consecutive ones?
out = double(diff([~A(1);A(:)]) == 1); v = accumarray(cumsum(out).*A(:)+1,1); out(out == 1) = v(2:end); or out =...

mehr als 8 Jahre vor | 3

| akzeptiert

Beantwortet
How to do max value
Y = [y1;y2;y3;y4;y5]; out = max(Y(:));

mehr als 8 Jahre vor | 0

Beantwortet
How I can perform a loop in order to calculate multiple means in a matrix based on multiple values?
>> [g,v] = findgroups(XMIN(:,1)); >> out = splitapply(@mean,XMIN,g); or [ii,jj] = ndgrid(findgroups(XMIN(:,1)),1:si...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Compare vector to matrix of unique dimensions
out = sum(permute(A,[3,1,2]) <= v,3);

mehr als 8 Jahre vor | 1

Beantwortet
how tho get the corners of an unknown matrix?
x = randi(125,6,8); y = flip(spdiags(x)); your_corners = [x(1);y([1,end])';x(end)]; or M = size(x,1); yo...

mehr als 8 Jahre vor | 0

Beantwortet
How to add the corresponding values in different matrices
C = {a,b,c,d}; c1 = cellfun(@(x)[(1:numel(x))',x(:)],C,'un',0); c1 = cat(1,c1{:}); out = accumarray(c1(:,1),c1(:,2));...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
how to reduce time grabbing values from indices of cell arrays?
d = [data{:}]; out = reshape(d(ismember([tag{:}],1:5)),5,[])';

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Finding equal values, between values, greater than and lesser than values of a matrix based on some values
A = [12 44 93 43 128 44 145 41 180 41 220 40 280 40]; a = 10; b = 95; c = 145; d = 290; ...

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
How to normalize the color vector to get color values in terms of percentage?
clr = ["red" "yellow" "green"; "cyan"; "blue"; "magenta"]; out = histcounts(h,[0,.083,.25,.4167,.5833,.75,.9...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
I need to store the values from calculation in the for loop instead it's given me a new value everytime
For MATLAB >= R2016a Let your variable "window" be here "window1". filtEMG = 20*sqrt(movsum(EMG.^2,[0 window1]))/window1...

mehr als 8 Jahre vor | 0

Beantwortet
How do I extract even rows and columns from any Matrix of size n?
M = [3 2 1; 1 4 6; 2 2 4; 1 9 7]; lo = rem(M,2) == 0; out_columns = M(:,all(lo)); out_rows = M(all(lo,2),:);

mehr als 8 Jahre vor | 1

Beantwortet
How to obtain first portion of a signal before it becomes negative?
Let name variable |trace1| ( |trace| - function from MATLAB) out = trace1(1:find(trace1 < 0,1,'first'))

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
How to copy anti diagonal elements to another matrix?
A = randi(127,7) B = randi(127,7) s = size(A); lo = eye(s) + flip(eye(s),2) > 0; B(lo) = A(lo);

mehr als 8 Jahre vor | 2

Beantwortet
How to replace repeating no.s in an array by distinct no.?
A=[7,6,3,5,3,6,6,2,9,6] [a,b] = unique(A,'first'); out = zeros(10,1); out(b) = a; out(out==0) = setdiff(1:10,a...

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
Sum over cell array of sparse matrices error: Dimension for sparse matrix concatenation must be <= 2.
a = cellfun(@full,a,'un',0); sum(cat(3,a{:}),3);

mehr als 8 Jahre vor | 0

Beantwortet
Difference between columns, fixed the first column, in a matrix
B = bsxfun(@minus,A(:,2:end,:),A(:,1,:)); B(B<0) = 0;

mehr als 8 Jahre vor | 2

Beantwortet
combine integers into date
y = 2016 M = 6 d = 2 h = 3 m = 5 s = 1 datetime(y,M,d,h,m,s,'F','MM/dd/uuuu HH:mm:ss')

mehr als 8 Jahre vor | 1

| akzeptiert

Beantwortet
How to delete rows from a matrix if its specific column does not match with another matrix?
BF = B(ismember(B(:,2),A),:);

mehr als 8 Jahre vor | 1

Beantwortet
Hi, How can i implement a function with 2 independent variables?
Use <http://se.mathworks.com/help/matlab/ref/griddedinterpolant.html?searchHighlight=griddedInterpolant&s_tid=doc_srchtitle |gri...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Find values between 50th to 75th percentile.
t = prctile(My_matrix,25) > My_matrix | prctile(My_matrix,75) < My_matrix; out = My_matrix; out(t) = nan;

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Hi everyone, Can you help me
sum([3:3:n,5:5:n]);

mehr als 8 Jahre vor | 0

Beantwortet
Hi; Can you help me to find fault?
function [y, mean_sine] = sindeg(deg) xx = deg/180*pi; y = (exp(1i*xx) - exp(-1i*xx))/(2i); mean_sine = s...

mehr als 8 Jahre vor | 2

Beantwortet
Subscript indices must either be real positive integers or logicals.
...beta.*(4*G.*(D1(f_(1,:))')... -> ...beta.*(4*G.*(D1*(f_(1,:))')... your expressing f1 = f_(1,:)'; a1 = D1*f1; ...

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
Sum only consecutive positive numbers...
l = [1 2 -3 4 -5 6 7 -8 9 10 11 12]; lo = l > 0; h = cumsum(diff([0;lo(:)]) == 1).*lo(:); S = accumarray(h + 1,l); ...

mehr als 8 Jahre vor | 0

Beantwortet
sum of the prime numbers
sum(primes(500)) or n = [2,3:2:500]; sum(n(sum(tril(rem(n(:),n(:)')) > 0,2)==(1:numel(n))'-1))

mehr als 8 Jahre vor | 0

| akzeptiert

Mehr laden