Respondida
Rearrange matrix and concatenate cells
If your datadimer is table: A = datadimer{:,:}; sZ = 291; [m,n] = size(A); k = m/sZ; out = reshape(permute(reshape(A,sZ,k,n...

casi 7 años hace | 0

Respondida
return row index of values greater than 0 to a 3 dimensional array
[ii,jj] = find(A > 0); out = accumarray(ii,jj,[],@(x){sort(x)'}); out{:}

casi 7 años hace | 0

Respondida
How to crop matrices at the maximal non-NaN values and then center the data
M = struct2cell(H); n = min(cellfun(@(x)find(any(isnan(x),2),1,'first')-1,M)); for jj = 1:numel(H) H(jj).matrix = H(jj).m...

casi 7 años hace | 1

| aceptada

Respondida
How can I extract the time column of a timetable
variant a = rand(20,6); date1 = datetime(2019,4,19) + hours(cumsum(70*rand(20,1))); TT = array2timetable(a,'RowTimes',date1...

casi 7 años hace | 3

| aceptada

Respondida
combining two text file with 100 equal number of header and body text
z = dir('file*_.txt'); zn = {z.name}; n = numel(zn); c = cell(n,1); for jj = 1:numel(zn) f1 = fopen(zn{jj}); k = t...

casi 7 años hace | 0

| aceptada

Respondida
How to assign NaN for empty cells in an array?
Finalanswer = ismember(T.Icnum,moga);

casi 7 años hace | 1

Respondida
How does Matrix(3002:2001:1999998)=0.4 works?
[ii,jj] = ind2sub([1000,2000],3002:2001:1999998); A = sparse(ii,jj,.4,1000,2000);

casi 7 años hace | 0

Respondida
Matrix problem with my vectors
theta = (-5:5:25)';%+ n = numel(theta); N = [-0.906 1.43 2.78 4.20 5.03 5.28 -2.49 0.889 4.16 7.71 11.0 7.30 12.7]*4.45; FN_c...

casi 7 años hace | 0

Respondida
How to subtract a number from a previous one
x = [1;.75;.5;.6]; n = filter(1,[1;1],x); or out = tril(toeplitz(x))*(-1).^(2:numel(x)+1).'; or n = x; for jj = 2:numel(...

casi 7 años hace | 2

| aceptada

Respondida
how to adjust the conv filtered data same like origanal data?
con=conv(h,L,'same');

casi 7 años hace | 0

| aceptada

Respondida
how to count the number of element in observation and make summation?
K = B.TotalRevenue.*ones(size(B,1),3)/3; [a1,~,c1] = unique(B{:,1:3}); out = table(a1,accumarray(c1,K(:)),'v',{'opals','Revenu...

casi 7 años hace | 0

| aceptada

Respondida
Create This Matrix to N-Value
n = 3; out = flip(fullfact([n, n]),2) - 1; or [x,y] = ndgrid(0:n-1); out = [y(:),x(:)];

casi 7 años hace | 0

| aceptada

Respondida
How to extend/add elements to an array?
A = [2 3 4 5 0 1 4 5 5 0 3 4 0 2 0 ]; B = [3 2 3 5]; out = A(sort([find(A),repelem(find(A == 0),B)]));

casi 7 años hace | 0

| aceptada

Respondida
comparison of the datasets
T = readtable('example.xlsx','sheet',1); T2 = readtable('example.xlsx','sheet',2); R12 = unique([T2.R1;T2.R2+eps(1e3)]); C = ...

casi 7 años hace | 0

| aceptada

Respondida
Data manipulation problem?
d = fopen('Data.csv'); c = textscan(d,'%s','delimiter','\n'); fclose(d); c=c{:}; x = regexp(c,'\-?\d+(\.\d+)?([Ee][+-]...

casi 7 años hace | 0

Respondida
Average over duplicate values in xlsx file
T = readtable('yourfile.xlsx'); T_out1 = varfun(@(x)x(1),T,'I',1:14,'G','StimuliName'); T_out2 = varfun(@mean,T,'I',15:18,'G...

casi 7 años hace | 0

Respondida
how to Interpolate hourly data
T = readtable('test.txt','ReadVariableNames',false,... 'Format','%d %d %d %f %f %f %f %f'); time1 =...

casi 7 años hace | 1

Respondida
How to obtain sum over coalition?
Variant for your new data from example.mat (B). BB = B{:,1:2}; abc = unique(BB(:)); n = numel(abc); C = cell(n,1); for ii =...

casi 7 años hace | 1

Respondida
The meaning of a length command
It's length of vector 'w'. >> w = 1.1:.01:1.9; >> length(w) ans = 81 >>

casi 7 años hace | 0

| aceptada

Respondida
How to separate a vector into positive and negative vectors using a for loop?
x = [-3.6 10 3 -1 11.4 0 7 -9.5 2 15 -1 3]; y = strings(numel(x),1); for ii = 1:length(x) if x(ii) >= 0 y(ii) =...

casi 7 años hace | 0

Respondida
How to form a for-loop to: find the onset (first element) of trials of zeros, ones and twos, in an array of sequences of zeros, ones and twos
n = numel(E); count1 = 1; start_of_trial = [1;zeros(n-1,1)]; trial_value = zeros(n,1); for ii = 2:n if E(ii) - E(ii-1) ...

casi 7 años hace | 0

| aceptada

Respondida
How to seasonalise daily weather classification and precipitation data
Where KNG01date_d? date1 = datetime(KNG01date_d,'ConvertFrom','datenum'); TT = array2timetable(KNG01rain_d,'RowTimes',date1...

casi 7 años hace | 0

Respondida
How to use a for-loop to find the onset (first element) of trials of zeros, ones and twos, in an array of sequences of zeros, ones and twos
function [start_of_trial, trial_value] = find_onsets(E) start_of_trial = find([1;diff(E(:))~= 0]); trial_value = E(sta...

casi 7 años hace | 2

Respondida
Substracting the value of upper row from all the values from the subsequent rows individually ?
A =[ 2130.18 2217.22 2334.24 2433.29]; out = A(2:end) - A(1);

casi 7 años hace | 0

| aceptada

Respondida
how to select the highest values form each column and set the other values to zero.
[m,n] = size(A); [~,ii] = sort(A); A(bsxfun(@plus,ii(1:end-2,:),(0:n-1)*m)) = 0; or [m,n] = size(A); [~,ii] = sort(A); A(i...

casi 7 años hace | 0

| aceptada

Respondida
How replace NaN's in a 3d field with the nearest value in the same column?
B = reshape(T,[],1); lo = ~isnan(T); ii = find(lo); C = interp1(ii,B(lo),(1:numel(B))','previous'); T_out = reshape(C,size(T...

casi 7 años hace | 0

| aceptada

Respondida
How to obtain sum over coalition?
s = string(('a':'d')'); ss = s([1 ,2;2,3;2,4;1,4]); v = [20,10,15,10]'; C = cell(4,1); for ii = 1:4 k = num2cell(nchoos...

casi 7 años hace | 0

| aceptada

Respondida
select data from different data sets
dat1 = [2015 12 10.44 371 4.32 2015 12 11.45 289 3.25 2019 38 16.56 456 1.78]; dat2=[2015 12 10.44 385 1.35 2015 12 11.89 ...

casi 7 años hace | 0

Respondida
matlab error operands to the || and &amp &amp operators must be convertible to logical scalar values
Thanks Walter! My typo. Use P((P< DA.Pl) | (P > DA.Ph)) = 0; instead if (P< DA.Pl) | (P > DA.Ph) P=0; end

casi 7 años hace | 0

Respondida
How can i know what is the n when the nth is the smallest or biggest
[minvalue, n] = min(A);

casi 7 años hace | 0

Cargar más