Answered
tresholding by summing over a dimension of a matrix
k = size(micron_62frames,3); lo = sum(micron_62frames,3) > 13e6; micron_62frames(repmat(lo,1,1,k)) = nan;

11 months ago | 0

Answered
Delete end points from columns in a structure array
S = cell2struct(cellfun(@(x)x(3:end-2),struct2cell(S),'un',0),fieldnames(S));

11 months ago | 1

| accepted

Answered
Averaging setions of a matix
out = cumsum(A)./(1:size(A,1))'; mnA = out(2:end,:);

11 months ago | 1

Answered
How To Generate Non Repeating floating Random Numbers from 1 to 10
z = cumsum(rand(100,1)); mn = min(z); Z = 9/(max(z) - mn)*(z - mn) + 1; out = Z(randperm(100));

11 months ago | 0

Answered
how to split data with 'or' condition ?
EDIT lo = [diff(tempdata_o4(:,4)) > 0;false]; i = cumsum(diff([false;lo]) == 1).*lo; C = accumarray(i + 1,(1:numel(i))',[],@(...

11 months ago | 0

| accepted

Answered
Creating a 2D matrix of non-zero modes from a 3D array
Q(Q == 0) = NaN; out = squeeze(mode(Q)); out(isnan(out)) = 0;

11 months ago | 0

| accepted

Answered
For each value in a vector, find the closest value in a cell and return index
sampled_freqs = [495 393 589]; cll = {'G4', 392; 'A4', 440; 'B4', 493.88; 'C5', 523.25; 'D5', 587.33}; [~,i] = min(abs(cat(1...

11 months ago | 2

| accepted

Answered
How can I make diamond shape with a matrix?
a = strel('diamond',250); out = kron(a.Neighborhood,[1 2 ; 3 4]);

11 months ago | 1

Answered
Detecting length and number of occurrences in a logical array
Without Toolboxes and Fileexchanges a = accumarray(cumsum([0;diff(array1(:))] == 1).*array1(:)+1,1); out = a(2:end);

11 months ago | 0

Answered
Manually interpolate a 2D array
a = rand(4,8);% Let a - your array F = griddedInterpolant(a); [i,j] = ndgrid(linspace(1,4,10),linspace(1,8,12)); % grid for ...

11 months ago | 1

| accepted

Answered
How to separate element from cell?
unique([U{:}])

11 months ago | 0

| accepted

Answered
insert specific number of rows into matrix if condition is met and fill new cells with specific value
In your case: n = max(a(:,1)); out = [(1:n)',nan(n,1)]; out(a(:,1),2) = a(:,2);

11 months ago | 1

| accepted

Answered
Problems exporting from matlab to exel
AVtNord=[AV;num2cell(A)];

11 months ago | 0

Answered
signature of values ​​when exporting to excel?
A = A'; B = B'; C = C'; writetable(filename,table(A,B,C))

11 months ago | 0

| accepted

Answered
summation of matrix in column
final_mat = [ 1 13 25 15 11 11 14 12 12 10 14 1 14 25 15 11 11 14 12 12 ...

11 months ago | 1

| accepted

Answered
How do I determine if the desired value in a vector is the Max or Min of the values around it
x = [ 21 19 20 17 16 17 18 16 15 13 15 16]; M = x(hankel(1:3,3:numel(x))); % max [peakmax,i] = max(M); peakmax = peakmax(i ...

11 months ago | 2

Answered
Count number of times value appears in column
out = histc(FinalRanking,1:296);

11 months ago | 1

Answered
Is there an alternative way to perform the following matrix transformation?
i = 3; [m,n] = size(A); j = hankel(1:i,i:m); out = A(sub2ind([m,n],kron(j,ones(1,n)),repmat(1:n,i,m-n+1))); or in your case ...

11 months ago | 0

| accepted

Answered
Find set of values that are unique to the values in another column
[G,d] = findgroups(A(:,1)); out = [d,splitapply(@mean,A(:,2),G)];

11 months ago | 1

Answered
Extract Min, Max and mean values for each month of each respective year. (Excel Data)
Please run file MATLABAnswer.m MATLABAnswer.m: T = readtable('Path\to\your\file\temptable.csv','Delimiter',',',... ...

11 months ago | 0

Answered
How to check ismember in a cell in Matlab?
result = cellfun(@(x)all(x == B{:}),List);

1 year ago | 0

Answered
Solving an equation with one variable
syms q a t E k1 k2 y eq = (q*a^4/(E*t^4)) == k1*y/t + k2*(y/t)^3; sol = solve(eq,y,'MaxDegree', 3);

1 year ago | 0

Answered
Reshaping 2d array
As in comment by Sebastian Bomberg's (for MATLAB >= R2016b): % Let A - your data of energy (150120 x 5 double) TT = array2time...

1 year ago | 0

| accepted

Answered
Matrix multiply with a function
i = [1:3;2,3,1;3:-1:1]; k = [.5;.78;.1]; f = [3;4;8]; d=[2 3 4;7 2 5;1 2 5]; l = k(i).*d + f(i); or l = kron(k(i),d) + k...

1 year ago | 1

| accepted

Answered
Combination of 4 Element
bl = cellfun(@(x)x(:)',bl,'un',0); n = numel(bl); ii = cell(n,1); for i = 1:n ii{i} = num2cell(nchoosek(1:4,i),2); end...

1 year ago | 0

Answered
Vectorisation of code for insertion of n x n matrices in a 3D array along the diagonal of a large matrix
A = full(gallery('tridiag',Z(n,1,:),cat(3,Z(1,1,1),Z(n,n,1:end-1)+Z(1,1,2:end),Z(n,n,end)),Z(1,n,:)));

1 year ago | 0

Answered
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 3-by-3.
A = kron(diag([1 1],1),I) + kron(diag([1 1],-1),I) + kron(eye(3),T);

1 year ago | 0

Answered
combinations with 2 columns
Combination = fullfact([2 2 2]);

1 year ago | 0

Answered
How to select every nth value with the last value fixed from a column?
a = original_vector([100:100:4901,4901]);

1 year ago | 0

Answered
Integrating function of t over numerical values
F = str2func(vectorize(FUN)); Q = integral(F,0,6);

1 year ago | 0

Load more