Beantwortet
Create a interdependent matrix in Matlab and repeat it for 10 times
nm = cellstr(reshape((string({'E','R','E','S'}) + ([101,1,106,1] + (0:9)'))',[],1)); T = repmat({tril(ones(4),-1)},1,10); ...

etwa 8 Jahre vor | 0

| akzeptiert

Beantwortet
Map an array yo another one
A=[3,5,6,10]; B=[1,2,3,4]; C = randsrc(8,5,B); ii = discretize(C,B); out = A(ii);

etwa 8 Jahre vor | 0

Beantwortet
How to arrange ascending order only one column of a matrix?
[~,ii] = sort(a(1,:)); out = a(:,ii);

etwa 8 Jahre vor | 0

Beantwortet
move all zeros to the right in a matrix
a = [1,2,3,0; 0,0,0,1; 8,0,9,0; 4,3,2,1]; b = a'; out = sort(b,'descend') out(out>0) = b(b>0); out...

etwa 8 Jahre vor | 0

Beantwortet
How to use logical expressions to change the values of a column who matches a condition on a different column?
>> V = [1 1 4 9 4 0 4 3 5 1 9 5 0 3 4 ...

etwa 8 Jahre vor | 0

Beantwortet
How to take an average every four columns?
A - your matrix (64 x 18144) B = A.'; [m,n] = size(B); t = minutes((0:m)'*15); Tb = array2timetable(B,'RowTimes',t...

etwa 8 Jahre vor | 0

Beantwortet
Turning imaginary numbers into real numbers
k = 1:100; n = 100 ./ k; s = sqrt( (.25*(n-.5*(100-n))./n-.25)./-(n - .5*(100-n))./n ); t = abs(imag(s)) > 0; s(t)...

etwa 8 Jahre vor | 4

Beantwortet
Storing Multiple Matrices in a Cell array
m_A = 20; ID = 3754; m_B = .002*ID + 3.1; J_A = 0.0013*ID + 0.188; g = -9.81; n = 30; M = 0:n-1; J_C = .0...

etwa 8 Jahre vor | 1

Beantwortet
Finding Continuous missing values (NaN) from a matrix
Let A - your vector with nan's out = sum(diff([0;isnsn(A(:))]) == 1)

etwa 8 Jahre vor | 0

Beantwortet
how to create this matrix [1 2 3 4 5;2 2 3 4 5;3 3 3 4 5;4 4 4 4 5;5 5 5 5 5]
[x,y] = ndgrid(1:5) out = max(x , y)

etwa 8 Jahre vor | 1

Beantwortet
Creation of matrix where the submatrices are resultants of smaller matrix multiplication
m = size(A,1); n = size(B,1); P = reshape(Q,n,m,[]); C = P; for jj = 1:size(P,3) C(:,:,jj) = B*P(:,:,jj)*A'...

etwa 8 Jahre vor | 0

| akzeptiert

Beantwortet
Merge two vectors into matrix
your_matrix = [vector1(:), vector2(:)];

etwa 8 Jahre vor | 14

Beantwortet
finding values of a b c d
A = [2 2 -7 -2 3 2 -5 6 9 -8 1 -4 1 5 3 -1]; b = [5;-17;14;9] abcd = A\b;

etwa 8 Jahre vor | 2

Beantwortet
one-by-one matrix assignment
[~,idx] = min(A); s = size(A); A(sub2ind(s,idx,1:s(2))) = B(end,:);

etwa 8 Jahre vor | 3

| akzeptiert

Beantwortet
linear index to matrix index
ii = 475000; m = size(A,1); r = rem(ii,m); c = ceil(ii/m);

etwa 8 Jahre vor | 0

| akzeptiert

Beantwortet
How to map a value of a vector into column number of a matrix?
n = numel(A); B = accumarray([A(:),(1:n)'],1,[10,n]);

etwa 8 Jahre vor | 0

Beantwortet
Insert array into matrix within a loop
m = size(X,2); out = zeros(m,50); for ii = 1:m out(ii,:) = your_function(X(:,ii)); end

etwa 8 Jahre vor | 1

| akzeptiert

Beantwortet
How to convert integer vector with the 1-of-K coding sheme into a matrix?
Y = [2 2 1 3 2 4 1 4 4 3]; m = max(Y); n = numel(Y); out = zeros(m,n); out( sub2ind([m,n],Y,1:n )) = 1

etwa 8 Jahre vor | 0

Beantwortet
Reshape array 3 variables into 2?
B = squeeze(A) or B = permute(A,[2,3,1]); or B = reshape(A,size(A,2),[]);

etwa 8 Jahre vor | 0

| akzeptiert

Beantwortet
Change headers on the table result
B = 2:11; out = array2table(B,'v',cellstr(string('X') + (1:numel(A))'))

etwa 8 Jahre vor | 1

| akzeptiert

Beantwortet
how to take vector and norm for indiviual column in the complex matrix
vk = G; for k=1:size(vk,2) vk(:,k) =G(:,k)/norm(G(:,k),inf); end

etwa 8 Jahre vor | 0

| akzeptiert

Beantwortet
How to create a special diagonal matrix with 2 vectors together?
full(gallery('tridiag',B(2:end),A,B(1:end-1))); or n = numel(A); out = full(spdiags([B(:),A(:),B(:)],-1:1,n,n)');

etwa 8 Jahre vor | 0

Beantwortet
How to add or multiply two different size of array using the loop iteration process?
bnew = repmat(b,1,numel(a)/numel(b))

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
For loop with a 10000x6
Let T - your table: T_out = T(T{:,1} ~= 0,:);

mehr als 8 Jahre vor | 1

Beantwortet
Concate cell array and calculate mean of each column.
B = cat(1,A{:})

mehr als 8 Jahre vor | 0

| akzeptiert

Beantwortet
How to circular shift a matrix for every 1 to 6 elements until its end?
A - your array k = 6; [m,n] = size(A); out = A1(sub2ind([m,n],repelem(hankel([(2:m)';1],1:n/k),1,k),repelem(1:n,m,1)...

mehr als 8 Jahre vor | 0

Beantwortet
sharing of numbers in the matrix
out = repelem(squeeze(max(permute(reshape(A,2,2,[]),[1,3,2]))),1,2)'; or out = A; [ii,jj] = find(A); t = rem...

mehr als 8 Jahre vor | 0

Beantwortet
How to sort the matrix rows based on a function over the rows
[~ii] = = sort(arrayfun(@(r) Map(M(r,:)), 1:size(M,1))); out = M(ii,:);

mehr als 8 Jahre vor | 0

Beantwortet
This code only plot for last value of r1, how to plot for all values of r1
For MATLAB >= R2016b r1 = (0:.1:1)'; r2 = 1-r1; f1 = 0:0.1:1; f2 = 1-f1; F1 = ((r1.*f1.^2)+(f1.*f2))./((r1....

mehr als 8 Jahre vor | 0

Mehr laden