Answered
Interpolating near discontinuties
f = @(x)5*x + (x > 2) plot(0:1e-4:3,f(0:1e-4:3)) OR: x=0:0.0001:2; y=5*x; x1=2:0.0001:3; y1=5*(x1)+1; p...

14 years ago | 0

| accepted

Answered
I Wish to generated a date matrix.
n = 100; DateMat = datemnth('03/31/2012', (0:n-1)'); OR: DateMat = datenum(2012,4+(0:n-1)',1,0,0,0)-1;

14 years ago | 1

| accepted

Answered
How to find location/coordinates of NaN in a sort condition?
[ii jj] = find(isnan(Data)); outij = sortrows([ii jj],1); OR [jj ii] = find(isnan(Data.'))

14 years ago | 0

| accepted

Answered
How to exclude more than 1 columns from a matrix?
Data = [2,1,4,6,2;9,4,6,1,2;5,3,2,8,3;7,2,1,9,3;7,1,8,2,4] out = Data(:,[1 2 5])

14 years ago | 3

Answered
filtering out matching IP addresses in form of 172.20.xxx.xxx from a cell S
p = '(^172\.20\.\d{3}.\d{3})|(^79\.141\.216\.\d{2})|(^95\.211\.85\.42)' aout = a(cellfun('isempty',regexp(a,p))) bout = ...

14 years ago | 1

| accepted

Answered
find all zeros
roots([21 0 1 0])

14 years ago | 0

Answered
Assign dates from cell array to matrix elements
d1 = d.textdata(3:end,2:3) out = datevec(strcat(d1(:,1),d1(:,2)),'mm/dd/yyyyHH:MM');

14 years ago | 1

| accepted

Answered
Operator matrix for matrix differentiation
symbolic function dNdv = diffmtx(v,N) % v -vector m x 1 - sym array % N - matrix m x n - sym array rz ...

14 years ago | 0

| accepted

Answered
matrix dimensions do not agree?
x = [1.4 1.5 1.6]; z=[4.1 5.3 6.7]; y = [0.2 0.31 0.43]; c = 0.1; %initial guess t=0.1:0.1:1; f = @(c,x)...

14 years ago | 0

| accepted

Answered
Solving equations, Numerical Integration, MSE, best fit overall parameter 'c'
x = [1.4 1.5 1.6]; y = [0.2 0.31 0.43]; c = 0.1; %initial guess t=0.1:0.1:1; f = @(c,x) arrayfun(@(x)trapz(t,x.*c.*t....

14 years ago | 0

| accepted

Answered
how to draw a vector with a set of certain values and a constant average?
A = nchoosek(reshape(ones(2,1)*[10 15 20],1,[]),4); M = unique(A(mean(A,2) == 15 & ~all(diff(A,1,2)==0,2),:),'rows'); ou...

14 years ago | 0

Answered
how to find the maximum length between few cell arrays
Let Ut - cell array 1 x 5 , contains column vectors with size n(k) x 1, for k = 1:5. Vtec - cell array 1 x 5, contains vector...

14 years ago | 0

Answered
Matlab coding
Let Ut - cell array 1 x 5 , contains column vectors with size n(k) x 1, for k = 1:5. Vtec - cell array 1 x 5, contains vecto...

14 years ago | 0

Answered
how to count the numbers
out = numel(Xy) *OR* so? out = unique(Xy)

14 years ago | 0

| accepted

Answered
removing unwanted pixels
Im = imread('Q8.png'); BW = im2bw(Im,graythresh(Im)); bw1 = imdilate(BW,[0 0 0 0 1 1 1 1]); s = regionprops(bw1,'Area...

14 years ago | 1

| accepted

Answered
Distribution in Array
A = 1:10; n = 3; C = kron(A,ones(1,n));

14 years ago | 0

| accepted

Answered
vector
mysteryFunction = @(x)conv([0 x(:)'],[1 1],'valid')

14 years ago | 0

Answered
finding the co-ordinates
st = regionprops(S, 'BoundingBox' ) eg: z = randi(15,size(S)) ij = ceil(st.BoundingBox); out = z(ij(2) + (0:ij(4...

14 years ago | 0

| accepted

Answered
counting data points
str = '11110111000001111100000111110000011111000001111100000'; x = str -'0'; k = find([true, diff(x)~=0]); out = [x(k...

14 years ago | 0

Answered
How to convert cell array to matrix
%A - data cell array A = arrayfun(@(x)randi(10,randi(5,1,2)),1:6,'un',0); %solution [m,n] = cellfun(@size,A) % ho...

14 years ago | 0

| accepted

Answered
dimensions not consistent when trying to save to a matrix
tot=[tot; xyz(:)];

14 years ago | 0

| accepted

Answered
Cell Array
y = cellfun(@(y)[y,zeros(1,max(cellfun('size',x,2)) - numel(y))],x,'un',0); y = cat(1,y{:}); [a,b] = unique(y,'rows','fi...

14 years ago | 0

Answered
How to sort rows of matrix according ot its amount of Nan?
[ii ii] = sort(sum(isnan(Data),2)) out = Data(ii,:)

14 years ago | 0

| accepted

Answered
Structure to matrix
'struct2cell' - built-in function of MATLAB >> which struct2cell about loop |for .. end| varnames=fieldnames(runoff...

14 years ago | 0

| accepted

Answered
Summing groups of ones
x1 = [~x(1) x(:)' ~x(end)] groupones = diff([strfind(x1,[0 1]);strfind(x1,[1 0])]); variant x1 = x(:); k = find...

14 years ago | 0

Answered
Are Regular Expressions the best way to do this job?
t = regexprep(A,{'[EK]G','_','\w*Radio','\w*PP','(cool\w*|freezer)','\w*vision'},{'',' ','Radio','PowerPlug','Freezer','TV'}) ...

14 years ago | 1

Answered
logical indexing of a matrix with different columns
lgc = youmatrix < -.1 | yourmatrix > .1; out = arrayfun(@(ii)find(lgc(:,ii),60,'first'),1:size(yourmatrix,2),'un',0);

14 years ago | 0

Answered
array to matrix
a = [10 20 30 40]; b = kron(a,ones(3,2))

14 years ago | 2

| accepted

Answered
Convert to date, hour, and minute
added after the receipt of Bahram's data [edited] d = [ 221 2012 43 1900 13.63 ...

14 years ago | 0

| accepted

Answered
How can I solve this linear System?
eg: x = rand(4,1); b = rand(4,1); solution nn = 1:numel(x); n = nn(end); idx = abs(bsxfun(@minus,nn,nn')) ...

14 years ago | 2

| accepted

Load more