Answered
new array using average row of the old array
ii = M == 0; out = bsxfun(@minus,M,sum(M,2)./sum(~ii,2)); out(ii) = 0;

13 years ago | 0

Answered
how to increase matrix size
s = size(A); P = cat(3,A,nan(s)); out = reshape(permute(P,[2 3 1]),s(2),[]).'; or out = nan(size(A).*[2 1]); ...

13 years ago | 1

| accepted

Answered
Custom coordinates into an array
ii = repmat({':'},1,M); ii(i) = {j}; out = A(ii{:});

13 years ago | 1

| accepted

Answered
comparing between two arrays
a=[2 3 4 ; 9 8 7]; b =[ 5 2 1 ; 6 3 2]; c=[ 4 7 1; 1 2 3]; data = cat(3,a,b,c); s = size(data); t = reshape(data(...

13 years ago | 0

Answered
Convert a matrix to { }
A = [0 1 2 3 4 5 6 7 8]; cellstr(sprintf('%d',A')')' other variant: regexp(num2str(reshape(A.',1,[])),'\d...

13 years ago | 0

Answered
looking for a command
A(A~=A) = 0

13 years ago | 0

Answered
How to make two rows of a matrix correspond to a vector
s = {'H';'He';'Li';'Be';'B';'C';'N';'O';'F';'Ne';'Na';'Mg';'Al';'Si';'P';'S';'Cl';'Ar'}; n = [1.0100 4.0000 6.9400 ...

13 years ago | 0

Answered
problem of matrix operations
toeplitz(0:3,-(0:3))

13 years ago | 0

Answered
breaking an if loop
t = false; for i = 1:N if t, break; end x(i) = xo - i*dx; y(i) = yo - i*dy; plot(x(i),y(i))...

13 years ago | 0

| accepted

Answered
Delete Rows with a specific condition
out = x(all(x(:,3:end),2),:);

13 years ago | 1

Answered
Help required with deleting rows of a matrix with similar first 2 elements (after summing up the last elements of rows to be deleted)
a = [1069 12059 100200 145 1069 12063 100200 471 1073 1001 100100 213 1073 1001 100101 213 1073 1007 100100 6...

13 years ago | 0

Answered
how to remove vowels using matlab ?
regexprep(s1,{'a','e','i','o'},repmat({''},1,4)) or regexprep(s1,'[aeio]','')

13 years ago | 2

Answered
Structure array to array
plot([s.x], [s.y])

13 years ago | 1

Answered
How to add limited row to specific row
A= zeros(2,9); B = [7 6 9 6 7 8 4 1 7 1 1 1 8 5 1 3 ...

13 years ago | 1

| accepted

Answered
Regular Expression to extract bigram
z=regexp(string,'\w*','match') strcat(z(1:end-1),{' '},z(2:end))

13 years ago | 1

Answered
how to find match using strfind from 2 different dataset sizes
d1 = {'apple'; 'orange';'banana'; 'pear'} d2 = {'apple-1'; 'pear-1'; 'apple-2';'banana-3'; 'orange'; 'apple-3'; 'banana-1';...

13 years ago | 0

| accepted

Answered
What should I do to add a new row and a new column to a matrix?
if you have |Image Processing Toolbox| N = padarray(M,[1 1]);

13 years ago | 0

Answered
fetching data from array
G=[1 1 1 1 2 2 1 2 3 2 2 1 3 3]; G1 = G(:); l = [true;diff(G1(:))~=0]; out = [G1(l),find(l)]

13 years ago | 0

| accepted

Answered
Regexp: different behavior for the same type of expressions
str = {'A7122_60a.iv2' 'A7122_60b.iv2' 'A7122_70a.iv2' 'A7122_70b.iv2' 'A7122_90a.iv2' 'A71...

13 years ago | 0

Answered
How do I create a vector combinations in pairs
d = fullfact([4 4]); out = d(diff(d,[],2)~=0,:); and A = [8 2 9 6 1]; n = 3; ix = fullfact(ones(1,n)*numel(A)...

13 years ago | 0

Answered
How to read elements of a matrix diagonally in MATLAB?
A=[2,5,7; 3,0,1; 9,17,23] k = spdiags(rot90(A)); s = size(k); nns = nan(s); ptr = tril(triu(ones(s)),s(1)-1); n...

13 years ago | 1

| accepted

Answered
Using ismember to seek out pairs
w = bsxfun(@eq,reshape(A',[],1),reshape(B',1,[])); out = any(blockproc(w,[3 2],@(x)sum(x.data(:)))==2,2); or w = bs...

13 years ago | 0

Answered
How to get columns with means that are greater than one, without using loops?
p1 = bestMatDiff; p1(p1 == 0) = nan; p2 = nanmean(p1); out = p1(:,p2 > 1); or p1 = bestMatDiff; t = p1 ~= ...

13 years ago | 0

| accepted

Answered
In an assignment A(I) = B, the number of elements in B and I must be the same, error.
x - vector -> dk1 = x-X(1), here dk1 - vector with length of x in your case dk - matrix with size 6 x 5: dk = zeros(nume...

13 years ago | 2

| accepted

Answered
Given y, how do I find the value for x?
>> f2 = @(y)arrayfun(@(y)fzero(@(x)1.96./x.*(1-exp(-0.83.*x))-y,1),y); >> f2([.03 1 12]) ans = 65.333 1.28...

13 years ago | 0

| accepted

Answered
how to round the decimal values
Please read about <http://www.mathworks.com/help/matlab/ref/round.html |round|> and about <http://www.mathworks.com/help/matlab/...

13 years ago | 0

| accepted

Answered
remove values from array under min & max conditions and under given number of consecutiveness.
x = dlmread('path_to_cte.txt'); z = x(~isnan(x)); t = z >= 25 & z <= 15; n = cumsum([false;diff(t) == 1]); out = z...

13 years ago | 1

| accepted

Answered
Combining two matrices into one
c = [a,b] % EDIT Please read about <http://www.mathworks.com/help/matlab/learn_matlab/matrices-and-arrays.html#btcd6e5-1 co...

13 years ago | 1

| accepted

Answered
find & replace data in array
A=[7 14 21 28 23 35 21 42 49 56 63 70 54 77 84 91] B = [22 55] M = abs(bsxfun(@minus,A,B')); t = bsxfun(@eq,M,min...

13 years ago | 0

Load more