Answered
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));

9 years ago | 0

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

9 years ago | 0

Answered
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 ...

9 years ago | 0

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

9 years ago | 1

| accepted

Answered
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

9 years ago | 0

Answered
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...

9 years ago | 1

| accepted

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

9 years ago | 0

Answered
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...

9 years ago | 0

Answered
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:...

9 years ago | 0

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

9 years ago | 0

Answered
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 = ...

9 years ago | 0

Answered
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 ...

9 years ago | 2

| accepted

Answered
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 ...

9 years ago | 0

Answered
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);

9 years ago | 1

| accepted

Answered
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)...

9 years ago | 0

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

9 years ago | 0

| accepted

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

9 years ago | 0

Answered
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...

9 years ago | 2

Answered
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)

9 years ago | 0

Answered
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(...

9 years ago | 0

Solved


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...

9 years ago

Answered
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]);...

9 years ago | 1

Solved


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

9 years ago

Solved


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 ...

9 years ago

Answered
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)...

9 years ago | 3

Answered
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);

9 years ago | 5

| accepted

Answered
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>.

9 years ago | 1

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

9 years ago | 0

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

9 years ago | 4

Load more