Answered
How to replace data in a matrix by comparing from another matrix?
[lo,ii] = ismember(B(:,1),A(:,1)); out = B; out(lo,2) = A(ii(lo),2);

11 years ago | 4

Answered
How can I sort this cell Array?
[~,ii] = sort(cat(1,ca{3}{:})); out = cellfun(@(x)x(ii,:),ca,'un',0);

11 years ago | 0

| accepted

Answered
How can I set the minimum values of a 3D matrix to 0 ?
A(A==min(A(:))) = 0

11 years ago | 3

| accepted

Answered
how to change values in matrix by indices
variant: a = [1,2,3 4,5,6 7,8,9]; [i1,i2] = ndgrid(1:size(a,1)); out = rem(i1+i2,2)*2.*a;

11 years ago | 0

Answered
How to implement sum of sines using matricies
a = 1:4; f = 1:4; t = 1:10; Ysum = sin(t(:)*f(:)')*a(:);

11 years ago | 0

Solved


Create a square matrix of zeros of even order
Create a square matrix of zeros of even order

11 years ago

Solved


Calculate square and cube of number
Calculate square and cube of number x

11 years ago

Solved


Look and say Conway's sequence
In mathematics, the look-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, 312211, ...

11 years ago

Answered
How to complete summation with column vectors?
Let your vectors this: x = ones(10,1); u = ((1:10)'-.5)/10; Solution: [ui,uj] = ndgrid(u); out = ui./(ui+uj)*...

11 years ago | 0

Answered
Fast way to replicate array
i1 = bsxfun(@plus,[0;N]+1,(0:N-1)*(2*N+1)); i2 = bsxfun(@plus,i1,reshape((0:F)*i1(end),1,1,[])); D = zeros(N,F,N,E); ...

11 years ago | 0

Answered
Intersecting lines from coordinates and fixed lines
x1=val(:,2); y1=val(:,3); x2=[-226.586 , -238.954]; y2=[112.566 , 49.459]; plot(x1,y1,x2,y2) P = InterX([x1.';y...

11 years ago | 1

| accepted

Answered
Create columns with no zero sequentially elements of a vector
B = zeros(size(A)); t = A > 0; B(strfind(0,t],[0,1])) = 1; b0 = cumsum(B); Bout = accumarray(b0(t)',A(t)',[],@(x){...

11 years ago | 0

Solved


Form Blocks in a 1D array
Lets say I have an array of size (10,1); I want to divide it into the num number of blocks which are given by user no_of_b...

11 years ago

Answered
Finding if numbers are within range
r = [1, 10]; xRange = [5 2 1 -1 5 67 3]; ii = xRange >= r(1) & xRange <= r(2) out = xRange; out(~ii) = nan;

11 years ago | 5

Answered
Which is the simplest way to create neighbourhood pairs?
hankel(a(1:end-1),a(end-1:end)) or [a(1:end-1)', a(1:end-1)'+1] or a1 = a(1:end-1) bsxfun(@plus,a1(:),[0 1]...

11 years ago | 0

Answered
How can I power the elements of a 3D matrix to the elements of 2D matrix?
Let you data is arrays |B| and |out_m| : B={}; out_m = {}; for jj = 1:3 out_m{jj} = randi(6,2,3,4); B{...

11 years ago | 1

Answered
creating matrix with colon
k = ones(3,1)*(-4:4); [m,n] = size(k); k2 = k.*rot90(triu(ones(size(k))),2); b = full(spdiags(k2,1-m:n-1,m,n)); or...

11 years ago | 0

| accepted

Answered
Subsetting equal data from a array to different arrays
a = [ 0.0010 0.0310 NaN 0.5873 0.0010 0.0590 NaN 0.8092 0.0050 0.0310 3.095...

11 years ago | 0

| accepted

Answered
Nested For loops- Pleeease HELP!!
ii = ismember(out_M(:,1),out_R); out_M(ii,2) = out_M(ii,2) - out_M(1,2); ?

11 years ago | 0

Answered
Extract matrices of a particular size
[a,b] = cellfun(@size,C); out = C(ismember([a;b]',[1,16],'rows'));

11 years ago | 0

Answered
Matlab time cell with 1 second interval
start_date='06-Jul-2011 15:20:00' end_date='06-Aug-2011 15:25:00' n = datenum({start_date;end_date},'dd-mmm-yyy...

11 years ago | 0

| accepted

Answered
How to find the product of each element of a matrix by itself and by the other elemets at the same row?
*EDIT* [n1,n2] = ndgrid(1:size(x)); y = x(:,nonzeros(tril(n1))).*x(:,nonzeros(tril(n2)));

11 years ago | 0

| accepted

Answered
how to solve this? :-/
>> out = @(c)[2.2-0.53*c(1)-24*c(1)^2-c(1)-8.5*c(1)*c(5)^2+0.7*c(9)^3 0.364-0.44*c(1)-1.44*c(2)-24*c(2)^2-c(2)-8.5*c(2)*c(6...

11 years ago | 0

| accepted

Answered
Calculating the average value of some variables during each sample time
A={ '29/07/2014 08:00:00.000' 152 28 2; '29/07/2014 08:08:01.000' 100 20 8; '29/07/2014 08:12:02.000...

11 years ago | 0

| accepted

Answered
Multiplying along the 3rd dimension of a 3D matrix
A = rand(16,16,100); out = A(:,:,1); for jj = 2:size(A,3) out = out*A(:,:,jj); end

11 years ago | 1

Answered
Converting 0-inf degrees into 0-360
Let your input angle |ang| : ang = 0:30:500; ang360 = rem(ang,360);

11 years ago | 1

| accepted

Answered
Matching different time series
Please try is it: A={'29/07/2014 08:00:06.415' 21 '29/07/2014 08:10:06.415' 23 '29/07/2014 08:18:06.415' ...

11 years ago | 1

| accepted

Answered
Concatenate cell arrays element-wise
out = strcat(A(kron(1:2,[1,1])),C(kron([1,1],1:2))); or [y,x]=ndgrid(1:2); out = strcat(A(x(:)),C(y(:)));

11 years ago | 0

| accepted

Answered
Read one column from a csv file into MATLAB for calculating
out = nanmean(ArrDelay); or in MATLAB R2015a out = mean(ArrDelay,'omitnan'));

11 years ago | 0

| accepted

Load more