Answered
need help in creating matrix.....please
a = 1:3; n = 3; k = perms(reshape(ones(n,1)*a,1,[])); aout1=unique(k(:,1:n),'rows'); *OR* a2 = cell(1,n); [a2{:}] ...

15 years ago | 1

| accepted

Answered
How to extract the values that I want in a cell array?
b = regexp(a,'\d\d\d\d\d','match') b = cat(1,b{:})

15 years ago | 0

| accepted

Answered
create matrix again.....need help...please
A = randi([100 200],10,10); B = randi(99,10,20); a = [1 1 2 1 2 1 1 2 1 1]; b = 2; k1 = arrayfun(@(i1)A(:,i1*ones(a(i...

15 years ago | 0

| accepted

Answered
Finding the row and column in a cell array!
a={'Mk1326=Scanner,Scan'; 'Mk1327=Scanner,Scan';'Mk1328=Scan';'0,26685,1,0';'Mk1329=SyncStatus,Sync';} out = a(~cellfun...

15 years ago | 0

| accepted

Answered
definite integral w/o using symbolic variable
m = 1:4; x1 = 2; x2 = 5; AUC = arrayfun(@(i1)quad(@(x)i1*x,x1,x2),m) _loop_ n = numel(m); AUC = zeros(n,1); for...

15 years ago | 1

| accepted

Answered
generating normal data with given average and standard diviation
please read: |doc randn|, example 1 more |doc normrnd| (Statistics Toolbox)

15 years ago | 0

Answered
averaging
d=randi(127,90,12); out = squeeze(mean(reshape(d.',size(d,2),30,[]),2)).'; *_or_* n = 30; a = zeros(size(d)./[n 1]); ...

15 years ago | 1

Answered
symbolic array, zero-based elements into another array
syms x11 x21 x31 x41 a = [ 1*x11 2*x21 3*x31 3*x41] b = [ 1*x11 2*x21 3*x41] c = a.*ismember(a,b)

15 years ago | 1

Answered
How to replace numbers in an array
a(a>=5)=5

15 years ago | 20

| accepted

Answered
How to get Matlab to solve an equation involving log(x) and a constant*x on LHS and log of a vector on RHS?
A=0.079; B=6*10^-9; C=3.5*10^-10; Is=260; syms I Cl R v = C*(50-R)*Cl - 2.5*log(Cl) - log(Is/I/(1-Is/I)) + log(...

15 years ago | 0

| accepted

Answered
create symbolic variables
a = [1 2;3 4]; x = sym('x%d%d',size(a)).' please read: |doc sym|

15 years ago | 0

| accepted

Answered
combination
c = mat2cell(x,4,[1 1 1 1 1]); out = cell(1,5); [out{:}] = ndgrid(c{:}); outd = cell2mat(cellfun(@(x)x(:),out,'un',0)...

15 years ago | 0

Answered
looping for a program
m = size(X,1); A = reshape(bsxfun(@plus,X(:,1),permute(Y,[3 2 1])),size(X,1),[]); out = mat2cell(A,size(X,1),ones(size(A,2...

15 years ago | 0

| accepted

Answered
Help to vectorize this matrix operation
*_variant_* [m n] = size(CH); k = size(tmat,2); out = CH*reshape(permute(reshape(tmat.',n,k,[]),[2 1 3]),3,[]); TC...

15 years ago | 0

| accepted

Answered
The problem of removing the data from the matrix
*_variant_* d = randperm(100).'; idx = bsxfun(@plus,1:7,(0:numel(d)-7)'); d1 = d(idx); ou1 = sum(d1,2); bnd = [250 30...

15 years ago | 1

Answered
solve n equation with n Variable
_*variant*_ function out = slveqs(namvar,n,eqs) %{ namvar - string (e.g. namvar = 'V') n - double (e.g. n = 2) ...

15 years ago | 0

| accepted

Answered
Find max/min eigenvalue of a symmetric matrix
please read: |doc eigs|

15 years ago | 2

| accepted

Answered
matrix
please read |doc diff| e.g. rho = randi(124,6) dz = diff(rho,1,2) % in your case

15 years ago | 0

Answered
Equations
*_variant 1_* S = ...; g = ...; As = ...; Zv = ...; rho = ...; Az = ...; out = fzero(@(Zd)S-g/As.*quad(@(...

15 years ago | 1

Answered
How to find unique elements in a cell array
[a b c] = unique(sortedinfo(:,2)); [id,id] = sort(c); out = mat2cell(sortedinfo(id,:),histc(c,1:max(c)),size(sortedinfo,2)...

15 years ago | 0

Answered
faster winner takes all
H = S > .75;

15 years ago | 1

| accepted

Answered
Function won't index properly
function [m, k] = Ammar_find(a,b) na = numel(a); nb = numel(b); if nb ~= na && nb > 1, disp('size "a" and "b" are ...

15 years ago | 0

| accepted

Answered
How to find k so that the integral from 0 to k equals a number
1. f = @(x)x.^2; out = fzero(@(x)quad(f,0,4)-quad(f,4,x),5) 2. syms y x real out2 = solve(int(x.^2,x,0,4)-int...

15 years ago | 0

Answered
length of vector
d = reshape([1 2 3 3 4 0 0 0 0 3 4 5 6 1 2 3 0 0 4 5 1 34 1 1 1 2 1],9,[])' out = sum(d~=0,2)

15 years ago | 1

Answered
Determine a percentage.
d = unifrnd(10,20,15,1) out = nnz(d>17)/numel(d)*100

15 years ago | 1

Answered
reorder label
L4 = zeros(size(L9).*[2 1]); L4(1:2:end) = L9; L4 = bwlabel(L4')'; Lp = L4(any(L4,2),:);

15 years ago | 0

| accepted

Answered
Further vectorizing a loop over bsxfun
bsxfun(@times,A,reshape(B,size(B,1),1,[])) or bsxfun(@times,A,permute(B,[1 3 2]))

15 years ago | 0

| accepted

Answered
how to do polynomial division
[a,b]=deconv([1 1 1 0 0 0],[1 0 1 1]) add p1=[1 1 1 0 0 0] p2=[1 0 1 1] [a b] = deconv(p1,p2) syms x k = cellfun(@...

15 years ago | 0

Answered
loops
e.g. temp = randi(40,5) rho2=(1-((temp+288.9414)./(508929.2*(temp+68.12963))).*((temp-3.9863).^2))*1000

15 years ago | 0

| accepted

Answered
retrieving data and plotting it
d = [ 1 2 0.2 .3 .2 .1 .2 .69 .87 .8 2 3 0.2 0.8 .7 .5 .6 .9 .5 .8 2 4 ...

15 years ago | 0

| accepted

Load more