Beantwortet
How to create an indexing program that removes numbers between values
ii = find(test2 < 0,1 , 'first')-1; out = [test2(1:ii-1),test2(test2 == test2(ii))]; after last Andrew's comment t ...

fast 9 Jahre vor | 0

Beantwortet
how to generate a random number between the range -50 to 50?
a = 10*(rand()-.5) or integer namber a = randi([-50,50])

fast 9 Jahre vor | 0

Beantwortet
Repeating elements in a matrix.
A=zeros(3,4); n = size(A,1); A([1:n+1:end,n+1:n+1:end]) = 1 or t = true(3,4); out = tril(t,1) & triu(t);

fast 9 Jahre vor | 1

| akzeptiert

Beantwortet
create and fill new matrices every nth row of an initial matrix
Let A - your matrix [3060 x 2] out = permute(reshape(A',size(A,2),170,[]),[2 1 3]);

fast 9 Jahre vor | 0

Beantwortet
Combining matrix of different dimension.
m1 = [2 2; 0 0]; m2 =[1 1;0 0]; m3=[2 2 2 2 ;3 3 3 3]; C = {m1,m2,m3}; [r,c] = cellfun(@size,C); m = ma...

fast 9 Jahre vor | 2

| akzeptiert

Beantwortet
How can I write a table from a matrix?
c = num2cell(pr,1); TTout = timetable(datetime(year1,month1,day1),c{:});

fast 9 Jahre vor | 0

Beantwortet
How to get title for excelwrite code depend on data of specific column
Let |data| - your data [1431770 x 4]. a = accumarray(data(:,4),1); out = mat2cell(data,a,size(data,2)); for ii = 1:nu...

fast 9 Jahre vor | 0

| akzeptiert

Beantwortet
How to read in various columns from a text file and output a new txt file with specific data.
T = readtable('sampledata.txt'); TT = table2timetable(T); TTout = TT(:,[4,6]); TTout.Properties.DimensionNames={'Time...

fast 9 Jahre vor | 0

Beantwortet
Subscripted assignment dimension mismatch for table variable
t1 = struct('f1','001','f2',2,'f3',3,'f4',4); t2 = cell2table(cell(4,4),'VariableNames',{'f1','f2','f3','f4'}); t2{1,:} ...

fast 9 Jahre vor | 0

Beantwortet
Separate duplicates into different numeric matrices
a = [100 1 0.44 100 2 0.12 100 3 1.86 100 1 0.02 100 2 3.29 100 3 0.39 101 1 0.32 101 2 0.29 101 3 0.5...

fast 9 Jahre vor | 0

Beantwortet
simulate hourly data from monthly data
Let TT - your data as <http://se.mathworks.com/help/matlab/ref/timetable.html?searchHighlight=timetable&s_tid=doc_srchtitle |tim...

fast 9 Jahre vor | 0

Beantwortet
is there a way to implement a for loop in which matrix multiplication is exist?
ii = 1:r; t = 2:n; k = r*(n-1); Y = reshape(reshape(W(:,ii,t),[],k)'*reshape(x(:,ii,t-1),[],k),r,[]);

fast 9 Jahre vor | 0

Beantwortet
I want count iteration in a binary matrix as follows.
out = diff(sort([strfind([0,I],[0,1]),strfind([I,0],[1,0]) + 1])); or out = accumarray(cumsum([1,diff(I)~=0])',1)';

fast 9 Jahre vor | 0

Beantwortet
replacing the for loops
cxy = permute(repmat(SortDate(q,4:6),1,1,L),[1 3 2]); here |cxy| your arrays |c,x| and |y| as |cxy = cat(3,c,x,y)|

fast 9 Jahre vor | 1

| akzeptiert

Beantwortet
Really easy one how to quickly repeat columns in an array
a = 1:10; out = a(:)*ones(1,10);

fast 9 Jahre vor | 1

Gelöst


Insert Special character in character cell array.
input={'a','b','c'} then ans={'a','*','b','*','c'}

fast 9 Jahre vor

Beantwortet
how to concatenate vetcors
t1 = ismember(k,v); v(ismember(v,k)) = temp; out = [v,k(~t1)];

fast 9 Jahre vor | 0

Beantwortet
Can I index into a timeseries using time?
use your data as <http://se.mathworks.com/help/matlab/ref/timetable.html |timetable|> and use <http://se.mathworks.com/help/matl...

fast 9 Jahre vor | 0

Beantwortet
Convert Cell to Struct
structtt = cat(1,tracks_array{:});

fast 9 Jahre vor | 3

| akzeptiert

Beantwortet
Integral of two function
Please read about function <http://se.mathworks.com/help/matlab/ref/integral.html?searchHighlight=integral&s_tid=doc_srchtitle |...

fast 9 Jahre vor | 0

Beantwortet
given an mxn matrix, we've have to find the sum of elements for which the sum of their row no.(x) and column no.(y) is greater than m(total no. of rows)
out = sum(A(flip(triu(true(size(A)))))) or for MATLAB >= R2016b [m,n] = size(A); out = sum(A((1:m)' + (1:n) > m)) ...

fast 9 Jahre vor | 1

| akzeptiert

Beantwortet
how to calculate conditional probability
[a,~,c] = unique(values,'stable'); d = reshape(c,[],2); dm = min(d(:,2)); ny = accumarray(d(:,2) - dm + 1,1); [a1,...

fast 9 Jahre vor | 3

| akzeptiert

Beantwortet
How to extract multiple matches into separate rows?
T = readtable('test sheet.csv'); T_variance = varfun(@var,T(:,[1,end]),'G','Groups'); for plotted For_plot = ac...

fast 9 Jahre vor | 1

Beantwortet
How can I count the number of zeros in a matrix until the value is non-zero?
B = sum(cumsum(A,2) == 0,2);

fast 9 Jahre vor | 2

Beantwortet
How to get 15-min average values from 10 min average values?
TT = timetable(minutes(10*(1:10)'),randi([-20,100],30,1),'V',{'var'}); % Let TT - your data TT_15min = retime(TT,minute...

fast 9 Jahre vor | 1

Beantwortet
How can I output multiple function outputs in a single vector (accessing all elements of an N-D array in a function)
output = cell(numel(siz),1); [output{:}] = ind2sub(siz,IND);

fast 9 Jahre vor | 0

| akzeptiert

Beantwortet
On re-arranging a matrix
omtx = 10*(1:6)' + (1:6); % your original matrix m = size(omtx,1); y = tril(true(m)); a = omtx.'; fmtx = y + 0; ...

fast 9 Jahre vor | 1

| akzeptiert

Beantwortet
how to find the equivalent resistance of two resistors in parallel and series
r1=1200; r2=1000; parallel = @(r1,r2)1/sum(1./[r1,r2]); % or: parallel = @(r1,r2)prod([r1,r2])/sum([r1,r2]); rt=paral...

fast 9 Jahre vor | 0

Beantwortet
how to find parallel of resistors
Z_parallel = 1/sum(1./z); % here z - parallel resistors Z_series = sum(z); % here z - series resistors

fast 9 Jahre vor | 0

Beantwortet
if elseif else in Table
ii = discretize(T.Time,[-inf,5,15,25,inf]) V = [5,15,25,30]'; T.TimeNew = V(ii);

fast 9 Jahre vor | 0

| akzeptiert

Mehr laden