Answered
time stamps (string to number)
A = {'09:35:00.000' '09:36:00.000' '09:37:00.000' '09:38:00.000' '09:39:00.000' '09:40:00.000' '09:41:00.000' '09:42:00.000'...

14 years ago | 0

| accepted

Answered
How to subsequently adding the matrix from row to row.
m = size(y,2); out = zeros(size(x,1),m) for j1 = 1:m out(:,j1) = sum(x(:,nonzeros(y(:,j1))),2); end

14 years ago | 0

| accepted

Answered
What are efficient ways to extract lower dimensional slices from a high-dimensional array ?
s = size(testarr); m = prod(s(1:2)); out = testarr(bsxfun(@plus,idx2*(s(1)-1)+idx1,0:m:(s(3)-1)*m))

14 years ago | 0

| accepted

Answered
Solving matrix of equations
use function |nlinfit| from |Statistics Toolbox| a =[1 1.5 1.3 1.7 0.8] b =[2 ...

14 years ago | 1

| accepted

Answered
substituting, indexing two matricies
t = B~=0 C = A C(t) = B(t)

14 years ago | 0

| accepted

Answered
converting floating point value to integer
A = [ 0.0004 0.0004 0.0004 0.0003 0.0003 0.0002 0.0006 0.0005 0.0005 0.0005 0.0004 0.0003 0....

14 years ago | 0

| accepted

Answered
how to draw multiple surfaces
e.g. sf1 = @(X,Y)sqrt(4*X.^2+3*Y.^2); sf2 = @(X,Y)sqrt(X.^2+Y.^2); [X,Y]=ndgrid(-2:.1:2,-2:.1:2); figure surf(s...

14 years ago | 2

Answered
Negating every second entree in a matrix column
idx = find(b) b(idx(2:2:end)) = - b(idx(2:2:end)) more variant [i1 j1] = find(b) [m m] = unique(j1,'first') k = sub2...

14 years ago | 1

| accepted

Answered
How to replace matrix element value with predetermined value?
A - your array with 0,48,49. [c c c] = unique(A) d = [0 0 1] Aout = A; Aout(:) = d(c) or Aout = zeros(size(A)); A...

14 years ago | 0

| accepted

Answered
minimum of an array
r = [1 3 5]; A1 = A; A1(r,:) = nan; [c,idx] = min(A1(:)); [i1,j1] = ind2sub(size(A1),idx);

14 years ago | 1

| accepted

Answered
How to shift diffrent rows with diffrent shift positions in matlab?
A = ['1111100100000000' '0000100000000000' '0000001110000000' '1111110010000000'] Aout1 = [circshift(A(1:2,:),[ 0 8]);...

14 years ago | 0

Answered
Truncate matrix elements to a particular length
xy = [X;Y]; d = diff(xy(:,end-[1 0]),1,2); k = 5 - sum(sqrt(sum(diff(xy(:,1:end-1),1,2).^2))) xy(:,end)= k/sqrt(sum(d.^2...

14 years ago | 0

| accepted

Answered
Feeding a vector to a cost function
function [f] = CostFunction(v) x = v(:,1); y = v(:,2); f=4*(1-x).^2.*exp(-(x.^2)-(y+1).^2) -15*(x/5 - x.^3 - y.^5).*e...

14 years ago | 0

| accepted

Answered
matching vectors of different length
A = [1 1 1 2 2 2 3 3 4 4 4 5 5 6 6 6]; C=[12 18 15 14 11 17]; output= C(A); *e.g.* [ *EDIT* 08:16MDT 13.12.2011 ] A = ...

14 years ago | 0

Answered
FOR Loop
aout = 0; for i1 = 1:numel(a)-1; aout = aout + a(i1) + a(i1+1); end _without loop_ |for..end| n = numel(a) aou...

14 years ago | 0

| accepted

Answered
Subscript indices must either be real positive integers or logicals
try this is cod x=-3:.1:3; Go=1000; Bc=5; Pin=@(x)3*exp(-x.^2); Ein = quadgk(Pin,-inf,inf); ...

14 years ago | 0

Answered
Pre-emphasis filter
*try* s3 = cell2mat(arrayfun(@(x)conv(s1(:,x),ypre(:,x),'same'),1:2,'un',0)); *or* s3 = zeros(size(s1)); for j1 = 1:siz...

14 years ago | 1

| accepted

Answered
dimwrite and zeros
x= [1 2 3 4 100 0 0 0 1 4 1 3 4 1 2 3 2 3 4 5 6 1 2 0] xc = num2cell(x); xc(cellfun(@(x)x==0,xc)) = {[]} xl...

14 years ago | 0

Answered
Weekday determination
function [dd,ddd] = dayweekwiki(y,m,d) dd = rem( ceil( d + 497 * (m / 4800 + y / 400) + 16870921 / 2400 ) - 1 , 7) + 1; ...

14 years ago | 0

Answered
Transforming Result to Meaningful Information
[j1,j1] = sortrows(M,1) [i1,i1] = sortrows(A,1) ji = sortrows([j1 i1],1) M(:,1) = A(ji(:,2),2)

14 years ago | 0

Answered
creating an image using a matrix
A = single(zeros(50)); A(ceil(m/2),ceil(n/2)) = 1 d = bwdist(A); r = 20; A(abs(d-r)<.5)=1; imagesc(A)

14 years ago | 1

Answered
Matrix form
s = N.^(1:3); bs = arrayfun(@(x)spdiags(ones(x,1)*[-1 1],[-1 1],x,x),s,'un',0); out = blkdiag(bs{:});

14 years ago | 0

Answered
plotting dates on x axis with labels auto generated for 1st Jan each year?
*_EDIT_* (0:20 MDT 09.12.2011) input data (e.g.): n = 22*12-7; datedata = datenum(bsxfun(@plus,[1990 12 16],[zeros(n,1) (0...

14 years ago | 0

Answered
Group string based on charachter
str2double(regexp(a,'\d+','match')) *and* regexp(a,'/','split')

14 years ago | 1

Answered
Easy question with probability
function F = myfun(P,X) x = cumsum([0 P(:).'/sum(P(:))]); x(end) = 1e3*eps + x(end); [a a] = histc(rand,x); F = X(a);

14 years ago | 2

| accepted

Answered
there‘s an error ,i can't deal with it,please give me a help
_*variant*_ of solution syms x s=solve((x+2).^x-2) xs=(s+2).^s use |'.^'|

14 years ago | 0

Answered
How to fill a table using (end,:)
A=[2,11,33;41,25,92;11,20,14] % e.g. A(end+1,:)= rand(1,size(A,2)) _*or*_ A(end+1,:)= [3 5 6] ets.

14 years ago | 0

| accepted

Answered
Vector derivetive symbolic how to calculate?
can use |Symbolic Math Toolbox|, please read about function <http://www.mathworks.com/help/toolbox/symbolic/jacobian.html |jacob...

14 years ago | 0

Answered
What is Unit8?
Maybe a misspelling of uint8?

14 years ago | 0

Answered
Issue With Integration Output
out = vpa(a,5) % sym class out = double(a) % double class out = eval(a) % double class

14 years ago | 1

| accepted

Load more