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 ...

4 years 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 ...

4 years ago | 2

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

4 years 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 ...

4 years 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)];

4 years 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',',',... ...

4 years ago | 0

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

4 years 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);

4 years 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...

4 years 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...

4 years 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...

4 years 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,:)));

4 years 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);

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 0

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

4 years ago | 0

Answered
How can I sort a matrix elementwise ?
A = [3, 4 ; 6, 2]; [m,~] = size(A); [B,i] = sort(A(:)); index = [mod(i-1,m) + 1, ceil(i/m)];

4 years ago | 1

| accepted

Answered
How can I find the exact value of the corresponding point in specific longitude and latitude?
load('data.mat');load('lat.mat');load('lon.mat');load('xy.mat'); F1 = scatteredInterpolant(LAT,LON,data) F2 = scatteredInterpo...

4 years ago | 0

Answered
Evaluation of function handler
F = F(x,y)x + y; FF = @(x)F(x,2);

4 years ago | 0

Answered
how to covert matlab time to actual time
T = readtable('SMPS1.xlsx','Sheet','Data','Range','1:481'); T.Time = dateshift(datetime(T.Date,'InputFormat','MM/dd/uuuu') + se...

4 years ago | 0

| accepted

Answered
Generating Daily Values using Hourly Values
T = readtable('your_xlsx_file.xlsx'); t = datetime([T{:,1:4}, zeros(size(T,1),2)]); TT = timetable(T{:,end},'RowTimes',t) ; T...

4 years ago | 1

| accepted

Answered
how can I find a specific data in time table in matlab?
i = diff(3*(data_mean_daily.tabrizmat7 < -3) + (data_mean_daily.tabrizmat7 > 1)) == -2; T_out = data_mean_daily([i;false]|[fals...

4 years ago | 0

| accepted

Answered
Convolution Coding in Matlab
h = conv(f,g,'valid')

4 years ago | 0

| accepted

Answered
Display char matrix vertically
volt = [18 33 31 34 15 37 10.5 48 50 38 35 39 42 33 31 1 5 9 13 11 27 35 -1 46 22 6 19 36]; edges = -40:10:0; [~,~,j] = histco...

4 years ago | 0

Answered
Replace Number array with characters
volt = [18 33 31 34 15 37 10.5 48 50 38 35 39 42 33 31 1 5 9 13 11 27 35 -1 46 22 6 19 36]; edges = [-inf,0:10:40,inf]; frui...

4 years ago | 0

Answered
How to include a switch statement within a for loop?
% Parameters a_R = 0.0325; a_T = 0.0325; N_T = 164; N_R = 10; mu_0 = 4*pi*(10^-7); f_Array = [10000,20000,40000]; w = 2*p...

4 years ago | 0

| accepted

Answered
Integers without repeating consecutively
function [repPos, pinCodeFix] = pinCodeCheck(pinCode) lo = [true;diff(pinCode(:)) ~= 0]; repPos = find(~lo); pinC...

4 years ago | 0

Answered
How can I insert a smaller ones matrix into a larger zeros matrix?
AA = [5:12;ones(5,1)*[0 8 8 8 0 5 5 5]] AA(end-1:end,1:5) = 1; AA(4,7) = 7; eq7 = AA == 7; le7 = AA <= 7; gt7 = AA > 7; ...

4 years ago | 0

Answered
Averaging the data from a 3d matrix and populating it in a 2D matrix.
B = mean(A,3);

4 years ago | 0

| accepted

Answered
Filtering rows of a table by giving a constraint to a particular column
FiltereddataofTable = A(A.Alpha > 100,:);

4 years ago | 0

| accepted

Load more