Answered
decimal day
for array |d| d =[ 2002 190 17 16 2003 345 7 14 ...

15 years ago | 0

Answered
Temperature data
[a,b] = find(diff(yourdata,1,2)>2) yourdata(sub2ind(size(yourdata),a,b+1)) = nan variant 2 s = size(yourdata); z = zer...

15 years ago | 0

Answered
how to multipy two polynomial expression?
syms x a=1+x+x^2 b=1+x out = expand(a*b) or coeffa = [1 1 1]; coeffb = [1 1]; out = conv(coeffa,coeffb)...

15 years ago | 15

| accepted

Answered
Skip multiple iterations in for loop
index=[0 0 0 0 1 0 0 0 0 0]; a=[]; b = 1; for i=1:10 if index(i)==1 if i==1 || index(i-1)==0 ...

15 years ago | 1

| accepted

Answered
matlab Integration function
f=@(x)8.3151e+006*x.^3-7.9844e+005*x.^2+20672*x-0.586 result = quad(f,0,.018) or p = [8315100 -798440 20672 -0.586] % c...

15 years ago | 0

| accepted

Answered
Split String into Alphabets
input_text' or in cell array cellstr(input_text')

15 years ago | 0

Answered
How to simplify the given code snippet?
colX2 = reshape(bsxfun(@plus,X,bsxfun(@times,t',dx(1:3))),[],1); or colX2 = reshape(bsxfun(@plus,X,t'*dx(1:3)),[],1)

15 years ago | 0

| accepted

Answered
selecting desired values
[j1,i1] = ndgrid(1:100,1:4); ind = [i1(:) j1(:)]; somedata = ind(randperm(numel(i1)),:); idx = bsxfun(@plus,(1:15...

15 years ago | 0

| accepted

Answered
generate a combination
data = 1:4026; out = sort(data([1:100:end,2:100:end])); or out = data([1:100:end;2:100:end])' or out = bsxfun(@plus...

15 years ago | 0

| accepted

Answered
Array processing problem
arr = zeros(3) val = [1; 0; 1] E = [1 2; 1 3; 2 3] arr(sub2ind(size(arr),E(:,1),E(:,2))) = val or arr = accumarray(E...

15 years ago | 0

| accepted

Answered
Subscript indices must either be real positive integers or logicals & Index exceeds matrix dimensions.
out = [(0:max(CA))',accumarray(CA+1,P,[max(CA)+1,1])] e.g. >> CA = randi([0 4],8,1) CA = 0 0 4 ...

15 years ago | 0

| accepted

Answered
Organizing data into a matrix, Generating a matrix
A = [100 5 1.0325 100 10 1.5648 100 15 1.1456 200 5 1.8986 200 15 1.6545 300 10 1.9879] [a1 j1 j1]...

15 years ago | 1

| accepted

Answered
Calling variables instead of values
xc = num2cell(x) [B C A]= xc{:} *ADD* x = [2 3 1] xc = {'A' 'B' 'C'} x1 = xc(x)

15 years ago | 0

| accepted

Answered
how to reorder the data
G = [1 2 4 5 9 0 2 3 6 7 2 3 6 7 1 2 4 5 8 9] G1 =...

15 years ago | 0

| accepted

Answered
can I construct an anonymous function that is a double summation?
f = @(i1,j1)sum(reshape(bsxfun(@minus,i1(:),j1(:)'),1,[]))

15 years ago | 0

| accepted

Answered
min value calling
[v,idx] = min(A,[],1) out = [v;idx;1:size(A,2)] or absolute |min| [v,I] = min(A(:)); [ir,jc] = ind2sub(size(A),I); ...

15 years ago | 1

| accepted

Answered
cell symbolic matrix into simple symbolic matrix
>> x = sym(0); A(1:4,1,1:4) = [ {x} {x} {x} {x}; {x} {x} {x} {x}; {x} {x} {x} {x}; {x} {x} {x} {x} ] A(:,:,1...

15 years ago | 0

| accepted

Answered
exiting a loop
k = 0; while abs(a-b)>=delta | k < 1e3 .... k = k + 1; end

15 years ago | 0

| accepted

Answered
Converting a cell symbolic matrix into simple symbolic matrix
about symbolic value 3d used ideas by Walter Roberson [x y z] = ndgrid(1:10,1:10,1:10); k = regexp(sprintf('A%-d_%-d_%-d '...

15 years ago | 0

Answered
Distance between a set of coordinates
|p| - coordinates (x,y) your five points p = rand(5,2); out = diag(boxdist(p'),-1)

15 years ago | 2

Answered
Problem to create a matrix
B = (1:300)'*16; A = bsxfun(@plus,B-16,0:.02:B(1));

15 years ago | 0

| accepted

Answered
Daily to monthly values in a loop
|yourdata| - your array (12 x 50) out = yourdata.*bsxfun(@(x,y)eomday(x,y),1951:2000,(1:12)') *corrected* yourdata - your a...

15 years ago | 0

Answered
How do you convert a 4D matrix into a N by M
e.g. a4d = randi(125,[2 2 2 2]) [s1,ign1,s3,ign2] = size(a4d) a2d = reshape(permute(a4d,[1 3 2 4]),s1*s3,[])

15 years ago | 1

Answered
Create a random Matrix
A1,A2,..,A8 - your vectors (nx1), let n = 5; for j1 = 1:8, eval([sprintf('A%d',j1),'=randi(20,5,1)']); end A = eval(['[',s...

15 years ago | 1

| accepted

Answered
Multiplying two vectors together
youfunction = @(p1,p2)conv(p1,p2) or [ *edit 10/24/2011 09:14 MSD* ] function out = yourfunction(p1,p2) m = numel(p1); ...

15 years ago | 0

Answered
converting a specific string to two fractions
numden = cellmat(@str2num,regexp( '12/345' ,'/', 'split'))

15 years ago | 0

Answered
Pulling Part of a cell out
C = ... {'00dgey46440e3d8' '0042f207' '00dfd431411'} lasts = cellfun(@(x)x(end),C)

15 years ago | 0

Answered
creating cell array
cellarray2too1={[5.3; 2.2; 3.3; 4.4; 1.1],[ 'a'; 'b'; 'a'; 'a'; 'b']}

15 years ago | 0

Answered
plotting
t=0:.00001:1; plot(t,2.5*cosd(10*pi*t)) hold on plot(t,2*cosd(8*pi*t)) or plot(t,[2.5*cosd(10*pi*t),2*cosd(8*pi*t)])...

15 years ago | 0

Answered
Linear combination of two single column matrix
C = bsxfun(@plus,A,0:mean(B-A)) or n = B-A; C = bsxfun(@plus,A,0:n(1)) or C = bsxfun(@plus,A-1,A(1):B(1)) or n =...

15 years ago | 0

Load more