Answered
How can I sort matrices in side structure ?
[ii,~] = cellfun(@size,{clust.Data}); [~,jj] = sort(ii); clust = clust(jj);

9 years ago | 0

| accepted

Answered
Vectorisation of a transform
function y=transform(x,f_x,z) dx=x(2)-x(1); n=length(z); %Convert data to mid point n_temp=length(x)-1; x_mid=x...

9 years ago | 0

Answered
Numerical Integration of Combined Functions with Conditional
Y = 20; [p1,p2]=ndgrid(1:3,6:8); integral(@(x)T(x,p1,p2),0,Y,'ArrayValued',1) here T-function as m-file: |T.m| f...

9 years ago | 1

Answered
Equation how to evaluate and obtain a value
Please try use function |vpa|: syms x f(x) = exp(5*x); df(x) = diff(f,x); vpa(f(2)) vpa(df(2))

9 years ago | 1

| accepted

Answered
Can I convert a linear vector into a number?
b = str2double(sprintf('%d',a)) other way b = 10.^(numel(a)-1:-1:0)*a

9 years ago | 3

| accepted

Answered
Calculate avergae values per hour, day, month and year
Let |data| - your data. %avergae values per hour [ah,~,ch] = unique(data(:,1:4),'rows'); out_hour = [ah,accumarray(ch...

9 years ago | 5

| accepted

Answered
How to access substrings out of cell array with indexing?
message = { 'error(1): occured due to A' ; ... 'error(25): occured due to B' ; ... 'error(306): occured due to ...

9 years ago | 1

| accepted

Answered
Matrix calculation, sum of two rows in each column
d= [ 2 3 7 6 7 8 9 1 5 4 3 5 6 7 8 2 3 ...

9 years ago | 1

| accepted

Answered
How to replace zeros in one matrix with another matrix
A = [1:3, 0,0 7,12,0]';% your first array B = randi(20,8,1); % your second array t = A == 0; A(t) = B(t);

9 years ago | 1

Answered
How to get specific value?
One way: A = [5 2 3 8 7 1 2 2 3]'; b = A < 4; ii = bwlabel(b); elementCounts = accumarray(ii(ii>0),1) value = A...

9 years ago | 0

| accepted

Answered
Functions involving column vectors
One way: [ii,jj,k] = ndgrid(A,B,C); W = C.^2 * (1 + C) .* (1 + C.*A) .* (1 + C.*b) ./ (2 + C);

9 years ago | 0

Answered
what can I do?
A = [10 25 30 45 50 150 300 450 500 501 502 600 630 700 720 800 801 81...

9 years ago | 1

Answered
How to randomise numbers in a vector?
Hi Elena! One way: x= [1 1; 1 2; 1 3; 1 4] [~,ii] = sort(rand(size(x,1),1)); out = x(ii,:); or just out = ...

9 years ago | 1

Answered
how to solve this problem
y = @(m) sqrt... and so on

9 years ago | 0

| accepted

Answered
replace numbers with letters in a vector or matrix
m=[2 2.8 2.5 2 2.5 2.8 2.5 37243]'; [~,~,c] = unique(m,'stable'); str = arrayfun(@(x)sprintf('worker%d',x),(1:4)','un',0...

9 years ago | 0

Answered
how to use 'find(A == x)' correctly for nonintegers x?
One way: out = find(abs(A - 1.5333) < tol); % Let here for example: tol = eps(1e4) or out = find(ismembertol(A,1.53...

9 years ago | 1

| accepted

Answered
How do I write a script that creates an M x N array of random numbers?
just a = rand(M,N) > .2;

9 years ago | 3

| accepted

Answered
Store tensor history into multidimensional array
sxx = reshape(1:9,3,[]); % sxx = [s11;s22;s33]; sxyz = reshape(11:19,3,[]); % sxyz = [s12;s13;s23] s = size(sxx);...

9 years ago | 0

| accepted

Answered
How can I incorporate the "s" symbolic variable in multiplication?
sys=tf(1,[1 2 2]); s = tf('s'); ctr=4+(3/s); e_cl=feedback(1,sys*ctr)

9 years ago | 3

Answered
how to find time difference between two times?
t1={'01-Oct-2011 11:12:00'}; t2={'01-Oct-2011 11:15:00'}; out = seconds(diff(datetime([t1;t2]))) or t1={'01-Oct-201...

9 years ago | 7

Answered
I got a task From my group studying class the Question is Quite confusing and I'm New to matlab. Here Is my Question and Plz Help me guys.
r = [12 23 44 54 23 6 65 100 212 45] c = [70,6,23,200]' [a,b] = sort(r(:)) [ii,~] = find(cumsum((a(:) - c(:)') >=...

9 years ago | 0

Answered
How to extract the numbers of the particular order from the sequence
a = (1:12)' out = [a([1:2,end-1:end]),reshape(permute(reshape(a(3:10),2,2,[]),[1 3 2]),4,[])]

9 years ago | 0

Answered
How can I add serial date and time for each 12 min ?
a =datetime([2009, 10, 09, 12, 36, 00;2009 10 10 22 24 00]) out = a(1) + (0:minutes(12):diff(a))' or a = datenum([2...

9 years ago | 0

Answered
how to get sum of elements of lower right triangular matrix.? i have tried this one, can anyone please correct this one
out = sum(a(rot90(tril(ones(size(a))),1)>0));

9 years ago | 0

| accepted

Answered
How to exclude the center/current number when performing movmax?
Let |x| - your data One way m = 20; M = conv2(x(:),[zeros(m+1,1); ones(m,1)]/m,'same'); M = M(m+1:end); Other...

9 years ago | 0

Answered
Write a single for statement to print the letters ā€˜A’ to ā€˜Z’ each 10 letters on a separate line.
a = 'A':'Z'; out = reshape([a,repmat(' ',1,mod(-numel(a),10))],10,[])';

9 years ago | 1

Answered
Outpt with zeros when should be values
intervals = [... 81.4358 735.1798 272.0970 1442.0839 515.2985 1682.2252 575.41885 1961.58675 734.95985 ...

9 years ago | 0

| accepted

Answered
Convolution of many vectors
f = @(k)[k+2, 5*k, k.^2]; A = f((1:5)'); [m,n] = size(A); B = zeros(1,m*(n-1)+1); B(1:n) = A(1,:); for ii =...

9 years ago | 0

Answered
Convolution of every row in matrix.
A = reshape(1:6,2,[])'; [m,n] = size(A); B = zeros(1,m*(n-1)+1); B(1:n) = A(1,:); for ii = 1:size(A,1)-1 ...

9 years ago | 0

Load more