Answered
Hot to find the matched values between two vectors and also related indeces
[idx,loc] = ismember(b,a); out = loc(idx); *ADD* after Knot's answer out = find(any(abs(bsxfun(@minus,a,b.')) < eps...

14 years ago | 2

Answered
array
Y = eval(['[',sprintf('Y%-d,',1:n),']'])

14 years ago | 0

Answered
Convert cell array with characters to vector with numbers?
50 - (char(y)-'0')

14 years ago | 0

Answered
change value in cells based on conditions
A = {[11 11] [22 22] [33 33 44]} idx = sortrows(perms(1:3)); A2 = A(idx); out = cell2mat(arrayfun(@(i1)[A2{i1,:}],(1:...

14 years ago | 0

Answered
Split large matrix in smaller matrices?
eg ( |A| - your matrix with size (169 x 4),) for each column: A = randi(3000,169,4); out = reshape(A,13,13,[])

14 years ago | 0

| accepted

Answered
Matrix manipulation
A - your matrix out = sum(ismember(A.',[1 1],'rows')) > 1000;

14 years ago | 0

| accepted

Answered
[Num,Txt,Raw]=xlsread......
|sum| for arguments of type |double| eg mean(Num(:,7));

14 years ago | 0

Answered
fsolve with multidimensional array and x0
for your case: *EDIT* b(:,:,1)=[2 3;4 6;1 9];b(:,:,2)=2.*[2 3;4 6;1 9]; a = [1 0 0 8]; b1 = zeros(numel(b(:)),numel...

14 years ago | 1

Answered
How can I put data into cell array at once time?
temp = cell(1,10); temp([1,2,10]) = {1,3,2} other way temp = num2cell([1:9,2]); etc.

14 years ago | 0

| accepted

Answered
error using vertcat
X = input ('input X in form : (first : step : last) -> '); X = X(:); A = input ('input constant A -> '); t1 = X <= 9...

14 years ago | 0

Answered
NaN+double~=NaN
eg A = [nan 2 3 5 nan] p = 5 out1 = A + p way without |NaN| A2 = A A2(isnan(A2)) = 0 out2 = A2 + p

14 years ago | 0

| accepted

Answered
Question about a function
tst = find(abs(W) < eps(100)); out = x(tst);

14 years ago | 0

Answered
Name of an array with strcat and int2str. Simple task or not ?
This is bad way - use many variables names: a=[1 2 3; 4 5 6 ; 7 8 9]; b=zeros(3,3); for i=1:3 eval(sprintf(...

14 years ago | 0

| accepted

Answered
generating random numbers from a range
please read about function <http://www.mathworks.com/help/techdoc/ref/rand.html |rand|> out = 1000 + 2000*rand(1000,1); ...

14 years ago | 0

Answered
double integral with one changing limits integral
Try this is code: f = @(x,a,b) sin(a*x+b); g = @(y,a,b) arrayfun(@(z)quad(@(x) f(x,a,b),0,z),y); h = @(a,b) quad(@(y)...

14 years ago | 0

| accepted

Answered
finding mean
a = whos; b = strcat({a(cellfun(@(x)isequal(x,[256 256]),{a.size})).name},','); AD_etc = eval(['{',[b{:}],'}']); AD_m...

14 years ago | 0

Answered
vlookup similar operation on unequal matrix size
one way [b12,b12] = intersect(x1,x2); [b21,b21] = intersect(x2,x1); y1 = y1(b12); y2 = y2(b21);

14 years ago | 0

Answered
Morphological operation
one way I = imread('1JK5Q.png'); BW = ~im2bw(I,.8); BW1 = imdilate(BW,ones(1,4));

14 years ago | 0

| accepted

Answered
bar plot, value on top
x=[1:2:23]'; y=abs([121 41 20.6 12.5 8.1 5.8 4.4 3.5 3 2.7 2.3 2.1]); bar(x,y) for i1=1:numel(y) text(x(i1),y(...

14 years ago | 16

| accepted

Answered
Error using plot - Vectors must be the same lengths.
Please try *EDIT2* n = size(X); for i1=1:n(3) % X is a MRI images sequence, it contains 30 images ENDO = roipoly...

14 years ago | 0

| accepted

Answered
Finding the position within a matrix
eg A = [... 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 ...

14 years ago | 0

Answered
Fitting a convolution
Try mdl = @(a, x)a*conv(exp(-x).*heaviside(x),sin(x),'same'); [fitted_par, r, J, cov, mse] = nlinfit(dataX, dataY, mdl,...

14 years ago | 0

Answered
Bootstrapping matrixes jointly
indata = [3 4 1 2 2 3]; [ii ii] = ismember([3 4 1 2 2 3],A); outdata = B(ii);

14 years ago | 1

| accepted

Answered
trying to fill a matrix with threshold data
t = bsxfun(@times,bsxfun(@gt,x,p),x); x2 = arrayfun(@(ii)nonzeros(t(:,ii)),1:size(t,2),'un',0); EDIT out = bsxfun(@...

14 years ago | 0

| accepted

Answered
delete rows which contain at least 1 zero
out = A(all(A,2),:); or out=A; out(any(A==0,2),:) = [];

14 years ago | 14

| accepted

Answered
loop for excel in MATLAB
one way [nt,nt,nt] = xlsread('nameyour.xlsx'); nt(cellfun(@isnan,nt)) = {256}; xlswrite('nameyour.xlsx',nt) *ON* S...

14 years ago | 0

Answered
Matrix combining with array in a specific manner
i1 = arrayfun(@(ii)ismember(A,B(ii,:)),(1:size(B,1)),'un',0); out = ones(size(B,1),1)*A.*cat(1,i1{:}); *or* out =...

14 years ago | 0

| accepted

Answered
Very simple vectorization ?
v = @(t1,dt,n)t1 + (0:n-1)*dt; eg v(0,1,10)

14 years ago | 0

| accepted

Answered
How can I change from format [654] to format '654'?
A= 654; A = num2str(A); if |A| - cell array with double values: A = {526 698}; A = cellfun(@num2str,A,'un',0);

14 years ago | 0

| accepted

Answered
word manupulation
d ={'A' 'B' 'hello' 'hi' 'enter' 'exit' 'me' 'you' 'love' 'hurt' 'what' 'how...

14 years ago | 0

| accepted

Load more