Answered
taking monthly correlation values
dnew = mat2cell(data,eomday(2011, (1:12))*24,size(data,2)); k = cellfun(@(x)num2cell(nonzeros(tril(corrcoef(x),-1))),dnew',...

14 years ago | 0

| accepted

Answered
index out of bounds because numel(c)=2
d = filter2([0,-1;1,0],[a;a+s],'valid'); d(d < 0) = 0; your code a = [0 15 35 60 85 110 230 345 460 500 620 740 860...

14 years ago | 0

Answered
Adding uneven matrices
variant (one of 100000) :) function out = addiffmatrix(varargin) n = cellfun('ndims',varargin); N = max(n); sz = cell2m...

14 years ago | 0

Answered
Finding intersection point of the lines
data = rand(20,3); x1 = sort(data(:,2)); x2 = sort(data(:,3)); y = data(:,1); pp = interp1(x1,y,'linear','pp'); ...

14 years ago | 0

Answered
generate a set data with random errors
er1 - random error - uniform distribution from -0.1 to 0.1 spr = .1; er1 = spr*sign(1.0-2.0*rand(1,num)).*rand(1,num); ...

14 years ago | 0

Answered
ranking a cell array
Cresult = cellfun(@times,CombnsData(:,1),CombnsData(:,2)) [C,id] = sort(Cresult); out = [CombnsName(id,:) num2cell(C)]

14 years ago | 0

| accepted

Answered
performing a command for the firts time
ti = 5.1; for i1 = 1:numel(t) if t(i1) > ti % your statements break; end end or ...

14 years ago | 0

| accepted

Answered
How do I derive polynomial using given roots?
v = [-2 -0.5 2 4.5] x= sym('x') yourpoly = expand(prod(x-v))

14 years ago | 1

| accepted

Answered
Alternate for flipr command in matlab
A = [33,47,44,49,40,21,45,48]; m = 3; n = numel(A); out = nan(m,ceil(n/m)); out(1:n) = sort(A,'descend'); out(:...

14 years ago | 0

Answered
Extracting the data
y = x(x~=0) or y = nonzeros(x) way bad with loop out = []; for j1 = 1:numel(x) if x(j1) ~= 0 ...

14 years ago | 0

| accepted

Answered
Convert cell to matrix with mixed data types
eg A = {[3] [4] [ 4] '#N/A' [2] [1] '#N/A' [ 3] [4] [2] [ 5] [ ...

14 years ago | 5

| accepted

Answered
deleting number
[C1,ic] = setdiff(A,B) [i1,i1] = sort(ic) C = C1(i1) OR C = A(~ismember(A,B))

14 years ago | 0

| accepted

Answered
Sorting and randomising a matrix according to a particular constraint.
variant m = size(A,1); n = 1:8; out = [1 1 1]; i2 = 1; while ~all(ismember(n,out(:,3))) && i2 < 100 i1 =...

14 years ago | 0

Answered
how add characters to sequence?
out = regexprep('qwe hj l',' ',' ') or a = regexp('qwe hj l',' ','split'); out = cell2mat(cellfun(@(x)[x,blanks(le...

14 years ago | 0

Answered
how we can control the length of each elemnts in a cell array?
C - your cell array out = cellfun(@size,C,'un',0)

14 years ago | 1

| accepted

Answered
??? Subscripted assignment dimension mismatch.
try this is code x=[-0.6 -0.4 -0.1 0.5 1.5]; y=[18 8 3 2 0.9]; fun1 = @(p,x)1./(x.*p(1)+p(2)); pout = nlinfit(x,y,...

14 years ago | 0

Answered
changing the values
in this case r = {'<=50k' '>50k' '>50k' '>50k'} [a n n] = unique(r) k = {0,1} rnew = k(n) *or* rnew = cell...

14 years ago | 0

| accepted

Answered
How do I visualize a matrix that has x, y, z and o values?
yourmatrix = [2,1,2,50;3,6,1,4] on comment <<http://img69.imageshack.us/img69/7662/formatl.png>>

14 years ago | 0

Answered
roots
please read about function <http://www.mathworks.com/help/techdoc/ref/roots.html |roots|> or use function <http://www.mathw...

14 years ago | 0

Answered
creating a vector of independent random cauchy variables...
x = tan(pi*(rand(1000000,1)-0.5));

14 years ago | 0

| accepted

Answered
Sorting the number
try this is code n = 8; x = 77; k = rem(x-1,n)+1; out = [x:x+n-k,x-k+1:x-1]

14 years ago | 1

| accepted

Answered
Calculating a weighted average of multiple matrices
A =[ 0 0.5 0.5 2 0 0 1 4 0 ...

14 years ago | 0

| accepted

Answered
Creating a specific lower rectangular matrix
A = 1:5; out = tril(toeplitz(A))

14 years ago | 2

| accepted

Answered
How do I resolve a syntax error when using BLOCKPROC?
please read help about function <http://www.mathworks.com/help/toolbox/images/ref/blockproc.html blockproc> eg fun = @(b...

14 years ago | 1

| accepted

Answered
Missing coefficients in symbolic expressions with coeffs
xx = symvar(A); Aineq = zeros(numel(A),numel(xx)); for j1 = 1:numel(A) [v1,v2] = coeffs(A(j1),xx); Aineq(j...

14 years ago | 0

Answered
Finding pixel location
eg k = rand(10) > .4 STATS = regionprops(k, 'PixelList','PixelIdxList')

14 years ago | 1

| accepted

Answered
Index exceeds matrix dimensions. Error
try variant % Your Function, input: h L = [-0.0065,0.0,0.001,0.0028,0.0,-0.0028,-0.002].'; %temp lapse rate : K/m...

14 years ago | 0

Answered
making an input to an array
d = input('enter date in view: mm/dd/yyyy -> ','s') [s,s] = weekday(d) dv = datevec(d); numdayinyear = diff(datenum([...

14 years ago | 0

| accepted

Load more