Answered
Cell Array indexing and manipulating
A = {'Cal', 'Golden', 'Bears', [5 7], {1 2 3 4}}; A{5}{3} or >> A = {'Cal', 'Golden', 'Bears', [5 7], [1 2 3...

12 years ago | 0

Answered
Multiplying a 2d matrix with each slice of 3d matrix
f1 = size(F); x1 = size(x); b = reshape(sum(bsxfun(@times,reshape(F,[f1(1),1,f1(2:3)]),... resh...

12 years ago | 2

| accepted

Answered
How can I vectorize this loop?
ARP = mean(bsxfun(@times,permute(A,[2,3,1]),permute(B,[3,2,1])),3); or ARP = squeeze(mean(bsxfun(@times,A,reshape(B,si...

12 years ago | 0

Answered
Sum up a value to a row and create new colum at the end of the cell
A(:,end+1) =cellfun(@(x)x+1,A(:,end),'un',0)

12 years ago | 0

Solved


Area of a circle
Find the value for area of the circle if diameter is given

12 years ago

Solved


Largest Prime Number
Given a matrix X, find the largest prime number in X.

12 years ago

Solved


Find the area of a rectangle if length of the diagonal is given.
if length of a diagnonal in rectangle is 5. Its area is 12.

12 years ago

Solved


Dimensions of a rectangle
The longer side of a rectangle is three times the length of the shorter side. If the length of the diagonal is x, find the width...

12 years ago

Solved


Create a two dimensional zero matrix
You have to create a zero matrix of size (mxn) whose inputs are m and n and the elements of your matrix should be zeros. Exam...

12 years ago

Answered
How to repeat a rectangular matrix in matlab?
for your case: t = zeros(6,2); out = [kron(eye(3),a(:,1:2)),t]+[t,kron(eye(3),a(:,3:4))]; variant m = 3; k=2;...

12 years ago | 0

Answered
fast and beautiful way to convert vector ranges to indexes
v2 = [5; 2; 3]; ii = cumsum(v2); v3 = zeros(ii(end),1); v3( ii - v2 + 1) = 1; v3 = cumsum(v3);

12 years ago | 2

Answered
Odd output from ind2sub
s = size(t); [val,ij] = max(reshape(t(:, :, 1560),[],1); [ii,jj] = ind2sub(s(1:2),ij); idxs = [ii,jj,1560]; or ...

12 years ago | 0

| accepted

Answered
Reducing values preceding the 1st minima to zero
ii = find(diff(diff(y)<0)==-1,1)+1; y1=y; y1(1:ii)=y(ii); or ii = strfind([0,diff(y(:)')<0],[1 0]); y1=y; ...

12 years ago | 1

Answered
Finding which array a particular element is from when comparing two arrays
[out,idxarr] = min([a;b]);

12 years ago | 0

| accepted

Answered
what is wrong whith my script?
It's MATLAB n = size(im); SNR = zeros(n(1),1); som1 = 0; som2 = 0; for ii=1:n(1) for jj=1:n(2) ...

12 years ago | 0

Answered
To delete rows from a cell array specifying conditions
data = raw(:,[3,14,17,20,21]); ll = ~cellfun(@(x)strcmp('nan',x),data(:,2)); out = data(ll,:);

12 years ago | 1

| accepted

Answered
How to find a maximum number not considered minus sign?
a = [4, 3, -8]; [~,ii] = max(abs(a)); out = a(ii);

12 years ago | 4

| accepted

Answered
Find X of corresponding Y which is manipulated?
[~,i1] = findpeaks(Fx); [~,i2] = findpeaks(-Fx); out = T(sort([i1;i2])); without |findpeaks|: ll = find(...

12 years ago | 0

| accepted

Answered
Differential Equation Matlab Resolve
Your odefun - |funnn|: function dy = funnn(t,y) q = 1./(1+t).^2; dy = [ y(2); -((q + 1)...

12 years ago | 1

Answered
Create matrix with double rows of [-1 1]
1. out1 = kron(eye(4),[-1;1]); 2. out2 = kron(eye(4),[1;1]); out2(out2>0) = bsxfun(@plus,[1;-1]*(1:4),[-1;0]);

12 years ago | 2

Answered
For each non NaN value in the 2rd column, remove the entire row of Cell
tf = cellfun(@(E) (numel(E)==1 && isnumeric(E) && isnan(E))... ||(all(isletter(E))&&strcmp('CALL',E))...

12 years ago | 0

Answered
How to do this: Multivariate Interpolation with random data (non-gridded)
Please use <http://www.mathworks.com/help/matlab/ref/scatteredinterpolant-class.html |scatteredInterpolant|>

12 years ago | 0

Answered
NaN selective removal from a matrix
b = a(any(a == a,2),:);

12 years ago | 0

Answered
how to segment a matrix based on the output in another matrix?
A1 = reshape(A,10,[]); C = A1(:,B); D = C(:); *EDIT* ii = ones(10,1)*B(:).'; D = accumarray(ii(:),A(:),[]...

12 years ago | 0

Answered
Usage of ndgrid for multidimensional arrays
Output = zeros(500,180,3); A1 = reshape(A,1,size(A,2),[]); for ii = 1:numel(B) Output(ii,:,:) = besselj(B(ii),A1)...

12 years ago | 0

| accepted

Answered
How to plot a 3d graph with uneven dimensions?
mesh(X,Y,values);

12 years ago | 0

| accepted

Answered
How to change particular element of a matrix by comparing with a scalar value?
try a=rand(4,10); b=round(a); y=[1 3]; beta1=0.30; c = b(y,:) t = a(y,:) <= beta1; c(t) = ~c(t); b(y...

12 years ago | 1

| accepted

Answered
Need algorithm to create the list
[z,y,x] = ndgrid(Survey_Location,Destination,Origin); out = [x(:),y(:),z(:)];

12 years ago | 4

Answered
Matrix Creation Code Problem
use [a,~,ii] = unique(A(:,1)); [b,~,jj] = unique(A(:,2)); f = @(x)x(1); % or f = @(x)x(end); or f = @(x)x(randperm(n...

12 years ago | 1

| accepted

Load more