Respondida
why doesn't limitation this work?
out = nn(nn >= 300 & nn <= 1300);

casi 8 años hace | 0

Respondida
How to get cumulative sum in yearly buckets
data = readtable('Reset Accum_temp.xls','range','A2:B32'); [~,~,c] = unique(data.Year); N = accumarray(c,data.Temperatur...

casi 8 años hace | 0

Respondida
How to split a matrix in two halves?
n = ceil(numel(A)/2); B = A(1:n) C = A(n+1:end); or n = ceil(numel(A)/2); BandC = mat2cell(A(:)',1,[n,numel(A)...

casi 8 años hace | 1

| aceptada

Respondida
How to replace variables ?
syms x y z = sqrt(100 - x.^2 - y.^2); zx = diff(z,x); zy = diff(z,y); dS=sqrt(1+zx.^2+zy.^2); fun = subs(x+...

casi 8 años hace | 0

| aceptada

Respondida
How to convert nominal variable to number?
str2double(string(nominal_var))

casi 8 años hace | 0

Respondida
I have data of bags sold one by one and the year its sold is given. I have used unique to get the years sorted. i need the number of bags per year using for loop. bags sold against the year has to be plotted.
counter = [unique(sales_year), accumarray(sales_year,1)]; or [g,v] = findgroups(sales_years); counter = [v,splitapp...

casi 8 años hace | 0

| aceptada

Respondida
Transform a cell of arrays to a table?
B = [A{:}]'

casi 8 años hace | 0

| aceptada

Respondida
Finding first series of consecutive negative numbers in an array
|strfind| already occupied by Guillaume. :) t = A < 0; out = find(sum(hankel(t(1:end-4),t(end-4:end)),2)==5,1,'first')

casi 8 años hace | 0

Respondida
How to find vectors that are multiple of other vectors inside a matrix
n = size(F,1); [x,~] = ndgrid(1:n); l = tril(x,-1); u = tril(x',-1); ii = [u(u~=0),l(l~=0)]; R = arrayfun(@(x)r...

casi 8 años hace | 0

Respondida
How to generate several matrix by varying one value?
ii = 10:15; A= [0 0 0 30 ; 70 30 0 0 ; 30 70 0 0 ; 30 0 70 0]; n = numel(ii); A ...

casi 8 años hace | 0

Respondida
I have a nxn matrix. How to get two variables [m,n] corresponding to the elements of the row of the matrix.(Kindly see the image)
B = reshape(A.',[],1); C = hankel(B(1:end-1),B(end-1:end)); m = C(:,1); n = C(:,2); or s = size(A,2); m = ...

casi 8 años hace | 0

| aceptada

Respondida
Matrix dimensions must agree. Error in electromagnet (line 10) Fe = nu_0.* N1.* N2.* s.*(i0./x).^2 ;
a=20*10^-3; b=20*10^-3; s = a*b ; N1=400; N2=400; x = [0.001:0.001:0.006]; i0 = [1:1:4]; Fe = nu_0.* ...

casi 8 años hace | 0

Respondida
skip counting numbers and including the remainder
n = 100; step1 = 4; seq = unique([1:step1:n,n]);

casi 8 años hace | 0

| aceptada

Respondida
From three vectors obtain the complete Vector that has the largest element, than the other two.
A=[12 3 4 5 6]; B=[ 3 15 7 6 4]; C=[ 9 1 18 2 7]; R = [A(:);B(:);C(:)]; n = numel(A); ii = ceil((1:3*n)/n); ...

casi 8 años hace | 0

| aceptada

Respondida
What is meant by "centered moving average" ? Is it different from 'moving average'?
variant for your case n = 5; x = randi(8,1,10); y = movmean(x,n); y = y((n-1)/2+1:end-(n-1)/2);

casi 8 años hace | 1

Respondida
i need a nested for loop
ii = (1:5)'; out = arrayfun(@(ii)[1:ii,ii-1:-1:1],ii,'un',0); or n = 5; A = [triu(ones(1,n).*(1:n)');flip(triu(o...

casi 8 años hace | 0

Respondida
How to repeat sample data in minutes?
data = randi(456,288,1); % your data time = minutes(5:5:1440)';% time of your data T = timetable(time,data,'v',...

casi 8 años hace | 1

Respondida
How can i delete the rows that have the same value in data file
out = a(any(diff(a,1,2)~=0,2),:);

casi 8 años hace | 0

Respondida
From date and time in different columns to datetime
datetime('2017-09-29') + hours(21:27)'

casi 8 años hace | 0

Respondida
Sum individual elements of rows that have identical elements in other rows
A = [19980227 0.100000000000000 0.0675470000000000 13.7500000000000 0.0704000000000000 0.000100000000000000 -0.001300000000000...

casi 8 años hace | 0

| aceptada

Respondida
How to plot intergratoion results into a table
out = table(tt,arrayfun(@(t0)100 - integral(@(tt)8*exp(-.1*tt),0,t0),tt),'v',{'Time','data'});

casi 8 años hace | 0

Respondida
Numerical Sorting of Cell Matrix by Single Column
A = { 'Wt0,4_Bw8,3_Bt0,4_Ah15_Aa0' '158.6' '9653.1008' '11' 'Wt0,4_Bw8,3_Bt0,4_Ah15_Aa10' '158.6' ...

casi 8 años hace | 2

| aceptada

Respondida
how to convert data from minute to hourly average
dir1 = 'path_to_folder_with_your_txt_files'; f = dir(fullfile(dir1,'iisc*.txt')); nm = {f.name}'; dt = datetime(regex...

casi 8 años hace | 1

| aceptada

Respondida
Convert a symbolic vector to a list of scalar outputs for a function created by matlabFunction
n = 5; c = sym('c',[n,1]); jacf= matlabFunction(jacobian(prod(c)),'v',{c}); use >> c = 1:5; >> jacf(c(:))...

casi 8 años hace | 1

| aceptada

Respondida
Flip a vector using for
out = flip(yourvector); with loop (no use) out = zeros(size(yourvector)); k = 1; for ii = numel(yourvector):-1:1...

casi 8 años hace | 0

Respondida
how can i take average of matrices in a cell?
A - your cell array one variant [m,n,k] = size(A{1}); [h,l] = size(A); A1 = reshape(cat(3,A{:}),m,n,k,h,l); out...

casi 8 años hace | 0

| aceptada

Respondida
How to normalize a matrix of dimension 450×40
|A| - your array Amin = min(A(:)); out = (A - Amin) / (max(A(:)) - Amin);

casi 8 años hace | 0

Respondida
Mean calculation from nxm matrices using nxm index matlab
out = [(1:12)',accumarray(Month_data(:),flow_data(:),[],@mean)];

casi 8 años hace | 0

Cargar más