Answered
i need to find peaks and valleys in a large array and store them in another array. help?
as |imregionalmax| and |imregionalmin| : A = elevation_data; a1 = inf(size(A) + 2); a2 = -a1; a1(2:end-1,2:end-1) ...

13 years ago | 0

Answered
re-formatting a matrix
dout = reshape(d(:,2),numel(depth),[]).';

13 years ago | 0

| accepted

Answered
How can I select all the nonzero elements of a matrix and give out a matrix?
MatrixAo = MatrixA(abs(MatrixA) > eps(100));

13 years ago | 0

| accepted

Answered
how to calculate mean and stdev of unequally intervalled data based on different time?
Your data in file |yourtext.txt|: 7/16/2012 6:40 2.20E+03 7/16/2012 6:45 1.87E+03 7/16/2012 6:50 1.83E+03 7/16/2...

13 years ago | 0

Answered
How to create a matrix from given vectors
C = zeros(max(A),numel(A)); C(A + (0:numel(A)-1)*size(C,1)) = 1; B = flipud(cumsum(C(end:-1:1,:)));

13 years ago | 0

| accepted

Answered
Conversion from uint8 to ascii to number
a = uint8([50 48 46 48 48 56 52] ); i0 = a == 46; a1 = a(~i0)-'0'; out = double(a1)*(10.^(numel(a1)-1:-1:0).')*10^-(f...

14 years ago | 0

Answered
Help needed in creating dynamic field names using struct in matrix form.
newData.(rename) = bsxfun(@minus,myData.Ep,[X Y]);

14 years ago | 0

| accepted

Answered
Extracting variables from a struct array with many empty structs
k = {StAr.f1}; out = zeros(size(k)); nonempty = ~cellfun(@isempty,k); out(nonempty) = [StAr.f1]; % (1) idx =...

14 years ago | 0

Answered
cell arrays to table or normal array in matlab
Your data: C = arrayfun(@(x){randi(20,randi(5),randi(3))},zeros(10,3),'un',0); C(randperm(numel(C),5)) = {[]}; % ...

14 years ago | 1

Answered
DISTANCE BETWEEN ANY TWO PLACES
use |Mapping Toolbox| Create data with coordinates of citys of Australia. eg global coord_citys_aus; coord_c...

14 years ago | 0

Answered
Counting frequency of occurrence in matrix
x =[ 22 23 24 23 24 23 24 22 22 23 23 23]; a = unique(x); out = [a,histc(x(:),a)];

14 years ago | 15

| accepted

Answered
averaging successive points in matrix
M = randi(100,26,149); n = 9; [a,b] = size(M); out = squeeze(nanmean(reshape([M,nan(a,mod(-b,n))],a,n,[]),2)); ...

14 years ago | 0

| accepted

Answered
vector matrix multiplication single row
a = rand(1,10); b = rand(10,100); out = bsxfun(@times,a.',b);

14 years ago | 2

Answered
single row matrix vector subtraction
best=randi(20,1,100); WIN=randi(40,10,100); out = bsxfun(@minus,WIN,best);

14 years ago | 0

| accepted

Answered
why we use same parenthesis for function calling and array?
function out = yourfun(a,b) m = randi(3,3); out = m(a,b); end or function out = yourfun2(a,b) ...

14 years ago | 0

| accepted

Answered
matrix replacement as string
shar = [1 2 3; 1 3 4; 1 4 5]; REP = repmat('v',3,1); sharcell = num2cell(shar); REPcell = cells...

14 years ago | 1

| accepted

Answered
3d to 2d matrix
A = reshape(reflectances.',[],w).';

14 years ago | 0

Answered
How to get defined integral?
x = linspace(-3,6,1000); y = x.^3 - 5*x.^2 - 4*x + 20; out = quad(@(x)x.^3 - 5*x.^2 - 4*x + 20,-2,5); or ou...

14 years ago | 1

Answered
Searching a matrix for duration value and replacing else
use function |regionprops| from |Image Processing Toolbox| |a| - your array with size < 1600 x 821 > out = ones(size(a))...

14 years ago | 0

| accepted

Answered
I want to extract half of the non-zero element of a matrix
ii = 1:fix(nnz(A)/2); At = A'; jj = find(At); At(jj(fix(nnz(A)/2)+1:end)) = 0; out = At';

14 years ago | 0

Answered
How count positive numbers, but when you get a negative, the sum stops. so then, sum the following sequence of positive numbers..
v = [1 1 -1 1 1 1 -1 -1 1]; z = v > 0; id = find([true;diff(v.') ~= 0]); k = diff([id;numel(v)+1]); out = k(z(id))...

14 years ago | 0

| accepted

Answered
how to extract special elements from a matrix
M2 = nonzeros(M1);

14 years ago | 1

Answered
Matrix for two variables
use function |ff2n| from |Statistics Toolbox| n = 3; a = [1.123456789 , 3.123456789]; ii = ff2n(n)+1; out = a(ii);

14 years ago | 0

| accepted

Answered
which packages do I need to use 'integral' function?
use function |quadgk| eg >> fun = @(x) exp(-x.^2).*log(x).^2; >> quadgk(fun,0,inf) ans = 1.9475

14 years ago | 1

| accepted

Answered
How can I get the min/max value of all fields in a stucture
out = min(structfun(@(x)min(x(:)),structure_1));

14 years ago | 3

| accepted

Answered
for loop for binary values from 00000 to 11111
out = rem(floor((0:63)'*pow2(-5:0)),2)

14 years ago | 1

Answered
Iteratively concatenate matrices held in a structure with column vectors stored in an 3xn matrix
outcl = cellfun(@(x,y)[x,y],struct2cell(euler),num2cell(MPV,1)','un',0); eulernew = cell2struct(outcl,fields(euler),1);

14 years ago | 0

| accepted

Answered
Extract specific values from vector
a=[0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0]; id...

14 years ago | 1

Answered
Repeating elements in a vector
for solution your problems you can use functions of MATLAB: |cumsum;| |zeros.|

14 years ago | 2

Answered
splitting an array of numbers
numbers = rand(1000,1); offsets = [0, 100, 250, 900, 1000]; out = mat2cell(numbers,diff(offsets),1);

14 years ago | 0

Load more