Answered
create single vectors from a matrix
Let Yourvector = randi(1000,100,1); out = reshape(Yourvector,10,[]); Columns in |out| - your vectors.

14 years ago | 0

| accepted

Answered
Character to date and time
A = { '2012-03-01T00:01:00.000Z' '2012-03-01T00:30:59.999Z' '2012-03-01T01:00:59.999Z' '2012-03-01T01:31:...

14 years ago | 0

| accepted

Answered
find the row number of values greater than...
One way: y = x > 20; t = [true, diff(y) ~= 0]; k = find(t); k = [k;k(2:end)-1,numel(t)]; idx = k(1,all(y(k)) & ...

14 years ago | 1

| accepted

Answered
observations every 8 or 9 weeks-interpolation
One way: d1 = datenum(A(:,1),'dd/mm/yy'); [y,m,d] = datevec(d1(1)); d2 = datenum(y,m,d+ (0:diff(datenum(A([1,end],1),...

14 years ago | 0

| accepted

Answered
How to turn a large array into multiple smaller arrays
out1 = reshape(yourmatrix,size(yourmatrix,1),2,[]); or out2 = mat2cell(yourmatrix,size(yourmatrix,1),2*ones(size(yourm...

14 years ago | 0

Solved


Finite Continued Fraction
Given an input real number x and a natural number n, output the row vector with the n first terms of the continued fraction. F...

14 years ago

Answered
rearrange the G matrix
n = numel(G); k = floor(n/2); p = ceil(n/2)+~rem(n,2); G([1:k,p:end]) = G([p:end,1:k]);

14 years ago | 0

Solved


AVIRIS Hyperspectral Bit Mask
The AVIRIS data sometimes is provided uncropped. This creates edge regions with values of "-50". Shown is AVIRIS Moffett Field i...

14 years ago

Solved


Sophie Germain prime
In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prim...

14 years ago

Solved


Generate N equally spaced intervals between -L and L
Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

14 years ago

Solved


Create a vector whose elements depend on the previous element
The idea is to create a vector A whose elements depend on the previous element : *A(i+1) = 2*A(i)+1* *2 Inputs*: - A : The...

14 years ago

Answered
How do i construct this matrix with else and elseif statements? Or should i be using cases?
nX = 6; nYp = 6; uaW = 1; uaE = 2; uaP = 3; uaN = 4; uaS = 5; nj=size(u(3:nX-1,2:nYp-1),2); ni=size(...

14 years ago | 0

Answered
How to have a changing variable within a user input?
Num = input('How many circles? '); disp('Now enter the diameter of each circle one at a time when prompted') D = zeros(N...

14 years ago | 0

| accepted

Answered
How to solve quadratic equations
try syms x y; f = solve((1/238.6318^2)*(x-222.8970)^2+(1/115.8401)^2*(y+95.96210^2),y); f1 = matlabFunction(f); ou...

14 years ago | 0

Solved


Create logical matrix with a specific row and column sums
Given two numbers *|n|* and *|s|*, build an |n-by-n| logical matrix (of only zeros and ones), such that both the row sums and th...

14 years ago

Answered
Comining the values and merging
A= {'' 'c0' 'c1' 'c2' 'c3' 'c4' 'c5' 'c6' 'yar12' 'hi' 'hello' 'hi' 'hello' 'hi' ...

14 years ago | 0

| accepted

Answered
Counting the neighbors in matrix
A = randi([0 7],10); A1 = nan(size(A)+2); A1(2:end-1,2:end-1) = A; k = (0:7)'; n = numel(k); out = zeros(n)...

14 years ago | 1

Answered
how can i write this lissajous function in matlab????
your_lissajous = @(t,a,b,d)[sin(a*t(:)+d), sin(b*t(:))]; eg of use function |your_lissajous| xy = your_lissajous(0:p...

14 years ago | 0

| accepted

Answered
dividing each row by maximum value
out = bsxfun(@rdivide,A,max(A,[],2));

14 years ago | 0

| accepted

Answered
Missing data values with interpolation
eg data Data = cell(1,5); for jj = 1:5 k = [randi(250,randi([10,15]),1); nan(randi([0 3]),1) ]; Data{j...

14 years ago | 0

Answered
filling the gaps in the sequence of dates
d0 = datenum(A(:,1),'mm/yy'); k = diff(year(d0([1,end]))) + 1; d1 = datenum(2009,(1:k*12)',1); out = num2cell(nan(num...

14 years ago | 0

| accepted

Answered
How can I select n numbers from a large data that equals the given average?
variant A = randi(4e6,1000); [d,ii] = sort(A(:)); B = conv(d,.1*ones(10,1),'same'); i1 = find(B <= 47,1,'last'); ...

14 years ago | 0

Answered
transforming two date vectors
a = regexp(DateInput,'(^\d*)(?=/)','match'); if any(str2double(cat(1,a{:}))>12) dfmt = 'dd/mm/yyyy'; else ...

14 years ago | 0

| accepted

Answered
Acquiring related Matrix Members
out = A(sub2ind(size(A),(1:numel(B))',B(:)));

14 years ago | 0

Answered
Finding a distance between two cities with matlab codes
use |Mapping Toolbox| eg: |citys1| - lattitude and longitude in degrees of Saint-Petersburg; |citys2| - lattitude and l...

14 years ago | 1

| accepted

Answered
How do I read in images of different dimensions into an array in matlab
try this is code: myArray = cell(1,numImage); for p = 1:numImage myArray{p} = imread(fullfile(H, myFile{p})); ...

14 years ago | 0

Answered
Do an interpolation in matlab
variant X = [352.4, 352.5 354.3;0.5050,2.4874,1]'; [xa,~,c]=unique(fix(X(:,1))); Xout = [xa,accumarray(c,X(:,2),[],@m...

14 years ago | 0

Answered
Find distance between point (1,3,1) and plane 3(x-2)+2(y-1)-3(z-1)=0
fp = @(x)(x(:).' - [2, 1, 1])*[3;2;-3]; % your plane x0 = [1,3,1]; % your point d = fp(x0)/nor...

14 years ago | 0

| accepted

Solved


Sum the entries of each column of a matrix which satisfy a logical condition.
Given a numeric matrix A and a logical array L of the same size as A, return a row vector S containing the columnwise sums of th...

14 years ago

Answered
How to extract the plate area only from black background
II=im2bw(I); s=regionprops(II,'Area','BoundingBox'); [ii,ii] = sort([s.Area],'descend'); out = imcrop(I,s(ii(2)).Boun...

14 years ago | 1

| accepted

Load more