Answered
Extracting a column vector from a 3D matrix
l = 10; s = size(A); [ii,jj] = ind2sub(s(1:2),l); out = A(ii,jj,:); other way C = zeros(size(A)); C(l)...

12 years ago | 2

| accepted

Answered
Scalar multiplication of a vector
bsxfun(@times,[a b],[x1 y1; x2, y2; x3 y3]) here |a, b, x1, y1, x2, y2,x3, y3| - numeric

12 years ago | 1

| accepted

Answered
Not Enough input arguments
solver = @(t,y)t - y; xspan = [0,1]; y0 = 2; [xo,yo] = ode23(solver,xspan,y0); if |solver| as m - file (your cas...

12 years ago | 0

| accepted

Answered
how to catch a matrix to a cell
strcat(s,{':'},arrayfun(@num2str,p,'un',0))

12 years ago | 0

| accepted

Answered
'rotating' matrix data around one point
data = [ -0.0052000 -0.0113000 -0.0178000 -0.0157000 -0.0053000 0.0033000 0.0073000 0.0080000 0.0071000 -0.0...

12 years ago | 0

| accepted

Answered
When using datasample for random selection how to store the nonslected values in a separate array?
A = regexp(sprintf('E_%d ',1:12),'\w*','match'); m = numel(A); n = 7; % nsamples k = 10; [~,ii] = sort(rand(m,...

12 years ago | 0

Answered
how to get the first 3 characters of each element in a cell to another cell
In the general case: filename = {'CZXDD2.2008052716-17hZCFPF.GY.txt', 'GOM.2008052716-17hZCFPF.GY.txt','GY3SAA9.2008052716-...

12 years ago | 0

Answered
Max filter for 5 x 5 and 9 x 9 pixel size
In your case use function |imdilate| from |Image Processing Toolbox|, for 5x5: B = imdilate(A,ones(5)); for 9x9: ...

12 years ago | 0

Answered
need help using the rand function.
Use: numberOfSamplesToTake = 20; a = randperm(numel(y)); sampleIndexes = a(1:numberOfSamplesToTake);

12 years ago | 0

| accepted

Answered
apply if else condition on 3d array
l = A == 0; C(t) = B(t);

12 years ago | 0

Answered
extract elements from a cell array
out = cellfun(@(x)x(:,1:20),C,'un',0);

12 years ago | 2

| accepted

Answered
How to extrapolate to outlying unknown datapoints in an 2D matrix
A = [0.000577900000000000,0.000585500000000000,0.000595090000000000,0.000603910000000000,0.000614910000000000,0.000623320000...

12 years ago | 1

Answered
create matrices based on a label sequence
claster_n = accumarray(B,1:numel(B),[],@(x){A(x,:)}); or with arrayfun claster_n = arrayfun(@(x)A(x == B,:),(1:max(B))...

12 years ago | 0

| accepted

Answered
Remove cells with spaces from cell array
out = core_data(~cellfun(@(x)strcmp(' ',x),core_data));

12 years ago | 1

| accepted

Answered
How do I store each output of my function as an vector element?
[tau,doppler,tau_p,doppler_p] = arrayfun(@wgenx,1:500); ADD [tau,doppler,tau_p,doppler_p] = arrayfun(@(x)wgenx,1:500...

12 years ago | 0

Answered
how to find average value of floating numbers ??
A = [0.33,0;0.53,0.2;0.433,0.2;0.11,0.5;0.95,0.4;0.99,0.5;0.32,0;0.44,0.3;0.38,0.4;0.62,0.1;0.23,0.4;0.44,0.5;0.76,0.5] ...

12 years ago | 0

Answered
Counting how many steps a value stays within a certain percentage in an array
A = [100 99 103 98 87 88 94 100] x = abs(bsxfun(@rdivide,bsxfun(@minus,A,A'),A)) <= .1; y = cumsum([true(1,numel(A))...

12 years ago | 0

Answered
Remove cells that contain only two or one character
xx = {'animal','a','aa','bc','dog','car','computer','screen','zx','tt','c','pen','ss'}'; out = xx(cellfun(@numel,xx) <=...

12 years ago | 0

Answered
replace the elements of a vector with an element sequence
A = [0 1 0 0;1 0 0 1;0 0 0 1]; B = randi(3,100,1); out = A(B,:); for negative values: B2 = [-1 -0.5 -0.2...

12 years ago | 0

| accepted

Answered
How to convert 3D matrix to 2D with a specific format
A = randi(100,3,4,4); a1 = num2cell(A,[1 2]); out = cat(1,a1{:}); or out = reshape(permute(A,[1 3 2]),[],siz...

12 years ago | 0

Answered
how to get index position of rows
[l0,idx] = ismember(tempfea,dbfea,'rows'); out = idx(l0);

12 years ago | 1

| accepted

Answered
how to create array for these values i got?
m = 5; idx = hankel(1:m,[m, m+1:numel(u)]); x = reshape(u(idx),1,m,[]); out = squeeze(min(exp(-bsxfun(@rdivide,bsxfun...

12 years ago | 0

Answered
Finding corresponding Y value in matrix with redundant data
x = [4 8 2 5 8 2]; y = [1 2 3 3 4 5]; l0 = ~ismember(x,y); out = unique(x(l0)); outidx = find(l0);

12 years ago | 0

Answered
How do I group/merge an O-D matrix?
[n,t] = xlsread('data2.xlsx'); tt = {t(:,1),t(1,:)'}; v = cell(2); for jj = 1:2 t1 = tt{jj}(~cellfun(@isem...

12 years ago | 0

| accepted

Answered
How to use values of a vector as indices for a matrix
L(:,3) = M(sub2ind(size(M),L(:,2),L(:,1)));

12 years ago | 1

Answered
how to split character data in string and double?
c = {'Time 12:57:33' 'Temp. T2 [deg.C] = 36.6' 'Solar Irradiance [kW/m^2] 0.857101'} regexp(c,'(\d*:)*\d*(\.\d*)*$...

12 years ago | 0

| accepted

Answered
calculation of successive diffrence
B = diff(A); B1 = conv(A,[1 0 -1],'valid'); idx = find(B == 2); ii = idx <= numel(B1); i2 = idx(ii); B(i2) = B1...

12 years ago | 0

| accepted

Answered
Create matrix from two arrays using colon
v = [100,200,300,400,500]; u = [105,205,305,405,505]; M = bsxfun(@plus,min(v(:),u(:)),0:abs(v(1)-u(1)))

12 years ago | 0

Answered
Extract 5 highest value of a vector
[a,ii] = sort(avgDE,'descend'); outidx = ii(1:5);

12 years ago | 1

| accepted

Answered
reshape a matrix with a divisible of 10....
r = 10; out = reshape([A(:);nan(mod(-numel(A),r),1)],r,[]) ADD out = reshape(A(1:fix(numel(A)/r)*r),r,[])

12 years ago | 2

| accepted

Load more