Answered
there are two 8 bit binary values in a single variable...how can i concate these two values???
on comment by Hemalatha a='asd'; b=double(a); c=dec2bin(b,8).'; out = c(:)';

11 years ago | 0

Answered
Finding the max sum of the sub arrays.
a=[7 2 6 14 30 15 12 0 20 21 300 67]; start=[2 8]; end1 =[5 11]; a1 = cumsum(a); out = diff(a1([start;end1]))+a(...

11 years ago | 1

Answered
How to change array element with another array
n = size(b); c = a; c(1:n(1),1:n(2)) = b;

11 years ago | 0

Answered
Split cell array taking into account difference between elements
n = cellfun(@numel,TES); ii = accumarray(cumsum([1;n]),1); ii = ii(1:end-1); T = cat(1,TES{:}) jj = [1; abs(diff(T...

11 years ago | 0

Answered
how to multiply simplest way this two vectors ?
a = accumarray(cumsum([1; y(:)]),1); x = xi(cumsum(a(1:end-1)));

11 years ago | 0

Answered
How to replace variable 's' in the transfer function with another variable
yourTransferfunction = @(g)d(g+1);

11 years ago | 0

Answered
creating new number from two numbers
sum(10.^(a-1:-1:0)*b) or polyval(b*ones(1,a),10) add polyval(b*ones(1,a),10^ceil(log10(b)))

11 years ago | 0

Answered
Simpler way without for loops
n = size(M); x = zeros(n); x(sub2ind(n,idx(:,1),idx(:,2))) = 1; out = reshape(M(cumsum(x,3) > 0),size(idx,1),[]);

11 years ago | 0

Answered
Curve fit for multiple variables
x = [x1(:) x2(:) x3(:) x4(:)]; abcde = [ones(numel(y),1),log(x)]\log(y); abcde(1) = exp(abcde(1)); your function ...

11 years ago | 0

| accepted

Answered
How to convert multiple images into row vector
... data_all{k}= data1(:)'; ...

11 years ago | 0

Answered
How to parse information between two strings using regular expressions?
str = '<sample>a,b,c</sample>'; out = regexp(str,'((?<=<sample>).*(?=<\/sample>))','match') or t = regexp(str,'...

11 years ago | 2

| accepted

Answered
subtracting matrices in a special way
a = randi(50,600,9); mx = randi(50,60,1); a7 = reshape(a(:,7),10,[]); out0 = bsxfun(@minus,a7,mx(:)'); out = o...

11 years ago | 1

Answered
How to use a vector as indices for matrix?
n = numel(V); A = accumarray([V(:) (1:n)'],1,[max(V) n]);

11 years ago | 0

Answered
regroupe the results in a matrix
S = num2str(f(f(:,1)>0,2))'; C = num2str(f(~f(:,1),2))';

11 years ago | 0

Answered
How to separate a matrix randomly
C1 = randi([0 1],size(A)).*A; C2 = A - C1;

11 years ago | 0

Answered
Help with assignment on functions
function c = cost(a) n = numel(a); c = 15*ones(n,1); k = a(:) - 2; l0 = k > 0; c(l0) = c(l0...

11 years ago | 0

Answered
Exponential Curve fit data a & b
use function <http://www.mathworks.com/help/curvefit/coeffvalues.html |coeffvalues|>

11 years ago | 0

Answered
Help with for loop
f1 = 100; f2 = 400; w1 = 2*pi*f1; w2 = 2*pi*f2; T1 = 1/f1; T2 = 1/f2; ns = 20; t = (0:T2/ns:4*T1); ...

11 years ago | 1

| accepted

Answered
Fully vectorized concatenation of multiple ranges?
lo = [1, 5, 20, 50] up = [2, 10, 40, 100] n = cumsum([1;up(:) - lo(:) + 1]); z = ones(n(end)-1,1); z(n(1:end-1...

11 years ago | 1

| accepted

Answered
How to make a new matrix with all common arrays from different matrices
m1 = [1;2;3;4;5;6;7;8]; m2 = [2;3;4;6;7;8;9;10;11;12]; m3 = [4;5;6;7;8;9;1;;16]; m4 = [8;8;5;4;3;1;6;7]; MM = ...

11 years ago | 0

Answered
Join some matrices without repeating arrays
r1 = [50;10;90;30]; r2 = [60;50]; r3 = [30;20;100]; r = [r1; r2; r3]; [~,b] = unique(r,'first'); out = r(...

11 years ago | 1

| accepted

Answered
area of triangle with dot product in matlab
a = [4,7,0], b = [6,8,0] , c = [3,12,0] v = [a;b;c]'; v3 = diff([v,v(:,1)],1,2); ii = [1:3;rem(1:3,3)+1]; l0 =...

11 years ago | 0

| accepted

Answered
How to eliminate array which contain zero, negative values, repeated values, etc constraint?
a=[1 5 1 6 2 6]; b=[2 5 1 6 2 5]; c=[3 5 1 6 2 4]; d=[0 4 1 6 3 7]; e=[1 4 1 6 3 6]; f=[-1 3 1 6 4 8]; ...

11 years ago | 0

| accepted

Answered
Concatenate matrices from cell array
A = rand(5,2); B = rand(7,2); C = rand(15,2); cc = {A B C}; out = cat(1,cc{:});

11 years ago | 12

| accepted

Answered
How can I save values in a 2d matrix corresponding to coordinates?
accumarray([y(:),x(:)],values(:))

11 years ago | 0

| accepted

Answered
Help using loop and range interval
v = randi([0,30],60,1); % Let your data k0 = 0.5*1.29*9.62; c = [0;.4;.2;.1;.001]; k = [-inf;3;10;14;25;inf]; [~,b...

11 years ago | 1

| accepted

Answered
how to xor r1 , r2 and resolve the following error?
x5 = '510E527FADE682D1'; bx5 = base2dec(x5,16); e = dec2bin(bx5,64); r1 = circshift(e,[0 +14])-'0'; disp(r1); ...

11 years ago | 0

Answered
Writing a script for multiple arrays with a set criteria for each array and identifying certain value locations
A = cat(3,[30 30 30 30 30 30 30 30 30 30 30 30 30 10 30 30 30 20 30 30 30 30 30 30 30 30 30 10 30 30 30 30 ...

11 years ago | 0

Answered
Can this be vectorized?
[lc,ii] = ismember(A,B); A(lc) = ii(lc); or with nan out = ii; out(~lc) = nan; or jast (with zeros) out ...

11 years ago | 0

| accepted

Answered
How to split the data wrt date in 3 dimensions array
ARR = randi(10,10,10,14975); % Your 3d array 10x10x14975 a = datenum([1979 1 1;2019 12 31]); yy = [1979 1 1;1980 1 ...

11 years ago | 0

| accepted

Load more