Answered
Excel Reading and Writing using Matlab
Hi Unnikrishnan PC! Hi Friedrich! added variant: [n t]=xlsread('eg1',1) xlswrite('eg1', n(~isnan(n)), 2)

15 years ago | 0

Answered
Geocode one grid from 2 grids with latitude and longitude values
variant: use |TriScatteredInterp| doc TriScatteredInterp eg: V = randi([-100 200],8,4) % your variable of interes...

15 years ago | 0

Answered
How to create image matrix via
M = randi([-123 421],10) % your matrix xy = [2,7;4,8] % coordinates of your rectangle in view [x1,x2;y1,y2] variant c = ...

15 years ago | 0

Answered
can u make black color region in to some other color say red or green in the given image but dont change the white color?
rgb = uint8(rand(5,5,3)<.25) rgb(rgb~=0) = uint8(randi([1 255],nnz(rgb),1)) bk = im2uint8(all(rgb==0,3)) rgb2 = rgb; ...

15 years ago | 0

Answered
Vectorizing bsxfun
my small contribution: [a b] = meshgrid(1:nTrain,1:nClass); dists = reshape(sum((rX(a(:),:) - rXClass(b(:),:)).^2,2),[],nTr...

15 years ago | 0

Answered
For loop
u1 = 255*sign(ima); but you get the array size is 1600 x 1600, with values ​​of -255, 0 and 255 _*ADD on comments*_ if i1 a...

15 years ago | 1

| accepted

Answered
How to specify , n ,the number of random integers
1 function r = random(x,y) r = round(x + (y-x).*rand); end OR random = @(x,y)randi([x, y]) 2 function r = randomn(...

15 years ago | 0

| accepted

Answered
Image Tiling
doc mat2cell example >> A = randi([-345 367],5) A = 235 -276 -233 -244 122 300 -147 347 -45...

15 years ago | 0

| accepted

Answered
finding last non-zero value from column
in your case sum(M) ADD sum(cumsum(flipud(M~=0))~=0)

15 years ago | 1

Answered
getting a matrix out of a matrix
Q(1:3,[2 4 6])

15 years ago | 1

| accepted

Answered
Matrix Indices Problem
size(A,2)+1-sum(cumsum(A,2)~=0,2) more (sum(cumsum(A')==0)+1)'

15 years ago | 0

Answered
Solving system of linear equation by Gaussian elimination
variant solution of system _A*x = B_, eg: A= randi([-23 907],5) B = randi([-23 907],5,1) c = [A B]; [m,n] = size(c); rezc = ...

15 years ago | 1

Answered
Finding root in Newton Raphson method
variant from book <http://www.liv.ac.uk/pjgiblin/maths/mfiles/ "Mathematical Exploration with MATLAB" by Ke Chen, Peter Giblin, ...

15 years ago | 0

| accepted

Answered
finding an output from a matrix using a single syntax
a=spdiags(Q(end:-1:1,:)) a1=a(:,[3,9]) out=a1(a1~=0)

15 years ago | 0

Answered
how to exit for loop
[i1 j1] = find(Isingle' == 1, 1, 'first') OR with loops for m=1:10 for n=1:sz(2) if(Isingle(m,n)==1) ...

15 years ago | 0

| accepted

Answered
Histogram of cell array ?
% Ain - 4-D cell array hist(cell2mat(cellfun(@(x)x(:),Ain(:),'un',0)))

15 years ago | 4

| accepted

Answered
for loop help
a=1:90; k = reshape(a,10,[]); k(1:3:end,:)=[]; c = k(:)' ADD a = reshape(1:90,10,[])'; c = []; for j...

15 years ago | 0

Answered
Numerical integration
y = 5; %eg: y-constant quad(@(x)f(x,y),xmin,xmax)

15 years ago | 0

Answered
Nested loop problem !
eg: a = randi(15,4,10) % array 4x10 b = randi(20,2,10) %array 2x10 a(3:end,:)=b

15 years ago | 1

Answered
finding index inside a region
BW = I==1; [~,L] = bwboundaries(BW); idx = find(L==2)

15 years ago | 0

Answered
Select neighbours of a vector efficiently
Hi Oleg! My version. a = 1:10; k = 4; k2 = k/2; nA = numel(a); idx = cumsum([[1:k2,k2+2:k+1];ones(nA-k-1,k)]); ...

15 years ago | 1

Answered
Any help for converting from s-matrix to z-matrix
U = eye(size(S)); Z = (U-S)\(U+S); U = eye(size(Z)); S = (Z-U)/(Z+U);

15 years ago | 0

Answered
create a white circle or sphere inside a black box
A=zeros(70,70); r = 10; %radius m = {40,40}; %midpoint A(m{:})=1; B = imdilate(A,strel('disk', r,0) ); imshow(B) *A...

15 years ago | 1

| accepted

Answered
Counting proportion of all rows taken by each unique row
more variant [B, I, J] = unique(X, 'rows'); out = diff(find([1; diff(sort(J)); 1]))/length(J)

15 years ago | 0

Answered
xlswrite
xlswrite('path_dataname', 1,1, 'A2')

15 years ago | 0

Answered
how to plot 3D graph using mesh() for a rectangular matrix of data?
[X,Y] = meshgrid(x,y); Z = fun(X,Y);% or Z - array double with size [length(x),length(y)] mesh(X,Y,Z)

15 years ago | 0

Answered
matrix indexing and for loops
1. Loop Z2 = zeros(size(Z)); for j1 = 1:size(Z,2) Z2(:,j1) = fun(Z(:,i1)); % ... perform desired function 'fun'... e...

15 years ago | 2

| accepted

Answered
Keeping k largest values in each column of a sparse matrix
k = triu(bsxfun(@minus,dd,dd')); pl = sum(k<0)+1==1:numel(dd); m = dd(pl); dd = m(cumsum(pl));

15 years ago | 1

| accepted

Answered
function error while using sb2ind function
conditions to work correctly isequal(~rem(CentroidTerm,1),bsxfun(@ge,CentroidTerm ,[1 1]),bsxfun(@le,CentroidTerm ,[m n])) ...

15 years ago | 0

| accepted

Answered
Simple wild card function for ismember??
d1 = datenum(Timestamp_str); d2 = datenum('00/0/0000 20:30:00'); out = Timestamp_str(abs(rem(d1,1)-d2)<1e6*eps,:) ADD var...

15 years ago | 0

Load more