Beantwortet
How to genneral a repeat array
For users |MATLAB R2014b| and older out = reshape(repmat(a(:)',3,1),[],1)'; or out = kron(a,ones(1,3));

mehr als 9 Jahre vor | 0

Beantwortet
How do you make a matrix of months??
de = [727563 727564 727565 727566 727569 727570 727571 727572 727626 727627 727628 ...

mehr als 9 Jahre vor | 0

Beantwortet
Matlab delete's value's from array
k = [1 20 3 0 NaN 19 2 1.1 NaN 20 1 0.9 NaN 19 2 0.4 0 18 0 0.3 1 19 1 ...

mehr als 9 Jahre vor | 0

Beantwortet
How to automatically get values from nx1 struct
b = [a.Centroid];

mehr als 9 Jahre vor | 1

| akzeptiert

Beantwortet
How to make a polynomial with negative power?
z = roots([.9, -2.2, 2.2]) % here your polynomial 0.9*x^2 - 2.2*x + 2.2

mehr als 9 Jahre vor | 0

Beantwortet
Is there a way to change a vector range by condition?
x=(-10:10)'; z = x(5:15); z(z>0) = 100; x(5:15) = z; or x=(-10:10)'; b = false(size(x)); b(5:15...

mehr als 9 Jahre vor | 1

| akzeptiert

Beantwortet
How to create a random matrix 8x8 with 2 decimals
x = round(a,2);

mehr als 9 Jahre vor | 0

Beantwortet
Can someone help me with my code? Topic: integration
out = trapz(V); or out = sum(V) - sum(V([1,end]))/2; or S = cumtrapz(V); or S = [0,cumsum(sum([V(1:en...

mehr als 9 Jahre vor | 0

Beantwortet
Trying to make a "snake" matrix?
N=5; M=9; T = reshape(1:N*M,N,[]); T(:,2:2:end) = T(end:-1:1,2:2:end); or T = reshape(1:N*M,M,[])'; T(2:2:...

mehr als 9 Jahre vor | 0

Beantwortet
How would the simpliest way to do this be?
A = {CityToCityRoadData.startAddress}; B = {CityToCityRoadData.endAddress}; C = [A(:);B(:)]; a = unique(C); [lo1,i...

mehr als 9 Jahre vor | 0

Beantwortet
Averaging the 3D-array
B = mat2cell(A,[2,2],[2,2],[2,2]); out = zeros(size(B)); for ii = 1:numel(out) [a,~,c] = unique(B{ii}(:)); jj = ...

mehr als 9 Jahre vor | 0

Beantwortet
I need a program to check prime numbers
out = n((n(:) == 2 | rem(n(:),2)) ... & any(rem(n(:)./([2,3:2:sqrt(max(n))]),1) ~= 0,2)); use ...

mehr als 9 Jahre vor | 2

| akzeptiert

Beantwortet
Given a matrix A = [2 5 7; 4 1 8], write a for loop that will replace all the even numbers with 0.
A(rem(A,2)==0)=0; or with loop for ii = 1:numel(A) if rem(A(ii),2) == 0 A(ii) == 0; end ...

mehr als 9 Jahre vor | 0

Beantwortet
How to get the total count of non zero&non NaN elements by column
a =[1 0 nan 0 nan 2 0 1 0 nan 4 6 3 0 nan] out = sum(~isnan(a) & a ~= 0);

mehr als 9 Jahre vor | 1

| akzeptiert

Beantwortet
How to make this complicated array
x=5; y=8; n = 1:(x+y-2); a = zeros(x,y); a([1:x,2*x:x:x*y-x]) = n; out = a + rot90((a + n(end)).*(a > 0),2)...

mehr als 9 Jahre vor | 0

Beantwortet
Leaping loop with constant rows for each identity
A - your array (n x 1) out = conv2(A,ones(12,1)/12,'valid');

mehr als 9 Jahre vor | 0

| akzeptiert

Beantwortet
For Loop and final output matrix
Variant: function [CrU,AgrCarbonSimu,MN,MN1,MSA1, MSA2, MSA3]... = CarbonProject(X...

mehr als 9 Jahre vor | 0

Beantwortet
how to count number of repeating's in data series.
A=[22 24 24 36 36 36 48 48 48 48 24 33 22 22]; V = A(:); [~,~,c] = unique(V); t = diff([0;c])~= 0; ix = cumsum...

fast 10 Jahre vor | 2

Beantwortet
How to update a value in different raw after performing validity check at one raw?
file(2:end,3) = cellfun(@(x)sprintf('%d',numel(x)),file(2:end,2),'un',0)

fast 10 Jahre vor | 0

Beantwortet
Copy certain number from one matrix to another
out = A(:,[1,2,2]); s = regionprops(bwlabel(A(:,2)-1),'PixelIdxList'); ii = {s.PixelIdxList}; jj = cellfun(@(ii)sort(...

fast 10 Jahre vor | 0

Gelöst


Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

fast 10 Jahre vor

Beantwortet
For Loop-Specific Dates
dte = datenum(2015,1,(1:sum(yeardays(2002:2015)))'); [~,~,dv] = datevec(dte); t = dv == 1; ii = cumsum([t(2:end);0]);...

fast 10 Jahre vor | 1

Gelöst


03 - Matrix Variables 4
Make the following variable: <<http://samle.dk/STTBDP/Assignment1_3d.png>> A 3x4 NaN (Not a Number) matrix (Hint: use ...

fast 10 Jahre vor

Gelöst


03 - Matrix Variables 3
Make the following variable: <<http://samle.dk/STTBDP/Assignment1_3c.png>> A 10x10 matrix where the numbers from 1 to 100 ...

fast 10 Jahre vor

Beantwortet
Explicitly Multiplication of Matrices using For Loops
s1 = size(A); s2 = size(B,2); out=zeros(s1(1),s2); for ii = 1:s1(1) for jj = 1:s2 p=0; for k = 1:s1(2)...

fast 10 Jahre vor | 3

Beantwortet
how to create n*n upper triangular matrix with conditions? (image attached)
n = 4; [ii,jj] = ndgrid(1:n); out = (ii == jj) - (ii < jj); or n = 4; out = eye(n) - triu(ones(n),1);

fast 10 Jahre vor | 5

| akzeptiert

Beantwortet
Is there a Change in Conforming matrix operations?
Yes. Please read <http://se.mathworks.com/help/matlab/matlab_prog/compatible-array-sizes-for-basic-operations.html about it>.

fast 10 Jahre vor | 1

Beantwortet
How to extract vertices from a matrix.
A = [... 4 5 6 10 11 12 22 23 24 36 37 38] B = reshape([A.'...

fast 10 Jahre vor | 0

Beantwortet
How to convert char into double?
with str2double out = str2double(regexp(val,'\d*','match'))

fast 10 Jahre vor | 4

Mehr laden