Answered
i plotted a graph its X-axis ranging from 0-1800 with a spacing of 200. how can i change the interval to 50 with same range(0-1800)
x=0:200:1800 y=sin(x) xi=0:50:1800 yi=interp1(x,y,xi) plot(xi,yi)

12 years ago | 0

Answered
Find the nearest point from a matrix to a particular point.
P=randi(100,10,2) % Example A=[25 5]; c=bsxfun(@minus,P,A) [out,idx]=min(hypot(c(:,1),c(:,2))) % The point is P(idx,:) ...

12 years ago | 0

Answered
How to 'extract" a matrix named the same way as a string in a matrix?
You want to extract 'E0' from L={'R1' 'E0'}, how? why do you wan to extract it when you already have it? From your question y...

12 years ago | 0

Answered
3d aray of images to 2d image
im=rand(60000,28,28) out=permute(im,[3 2 1]) out(:,:,1); % is the first image out(:,:,2); % is the second image %and so on...

12 years ago | 1

Answered
auto format x axis
Maybe you need |XtickLabel| property

12 years ago | 0

Answered
Loading tab delimited .txt file with mix of strings and numeric data
ii=fopen('file.txt') s=textscan(ii,'%s') fclose(ii) out=regexp( cellstr(s{1}),'\d+(\.)?(\d+)?','match') out=cellfun(@(x) s...

12 years ago | 0

Answered
Combining data with matching elements in the first two columns
M=[920 381 784 0 920 381 0 21.4375 23 388 1703 0 23 388 0 4.109375 445 487 304 0 445 487 0 15.09375 ...

12 years ago | 0

Answered
append one graph to another
Use plotyy % Example x=0:0.01:10 y1=sin(x) y2=100*cos(x) plotyy(x,y1,x,y2)

12 years ago | 0

| accepted

Answered
how to find elements in an array
x = 1:100; y = 201:300; a = [250; 215; 283]; out=x(ismember(y,a))

12 years ago | 0

| accepted

Answered
Concatenation of 3D Array into 2D Array
A=rand(20,12,30) B=A(:,:)

12 years ago | 1

Answered
How to plot this ?
Your can't plot your code. %example simout_a=rand(10,2); simout_b=rand(10,2); residsumsq = norm(simout_b(:,1)-simout_...

12 years ago | 0

| accepted

Answered
error of All contents of the input cell array must be of the same data type.
|'p4004'| is a string when the other data are double. you can't use cell2mat with mixed data types If you need to extract a ...

12 years ago | 1

| accepted

Answered
Need to split matrix(m x n) where n varies
M=rand(7745,13); [n,m]=size(M); m=m-1; c1=M(:,1); mm=fix(m/6)*6; m1=m-mm; M(:,end+1:end+mod(6-m1,6))=nan; A=M(:,2:end);...

12 years ago | 1

| accepted

Answered
Do not understand my error message
ns=10 theta=100 for s=1:ns if s==1 y=1 else y=theta end end

12 years ago | 1

Answered
how can i average array 1 based on values in array 2
c1=40*sort(rand(40,1)) c2=rand(40,1) [ii,jj]=histc(c1,0:10:40); ii=[0 ;cumsum(ii(1:end-1))] for k=1:numel(ii)-1 idx=i...

12 years ago | 0

Answered
Multiplication of matrix with It's Diagonal Element to It's Row
a=[1 2 3;4 5 6;7 8 9] out=bsxfun(@rdivide, -a,diag(a)) out(sub2ind(size(a),1:size(a,1),1:size(a,1)))=1

12 years ago | 0

| accepted

Answered
matrix indexing without for loop
[sorted_matrix,ind]= sort(c,3) You can get sorted_matrix by using [n,m,p]=size(c); [ii,jj]=ind2sub([n,m],1:n*m); q=s...

12 years ago | 0

Answered
How to use imwrite command for manually save image?
file=fullfile(pathname,filename) imwrite(y,file);

12 years ago | 2

| accepted

Answered
Frustrating for what should be simple… What have I done wrong?
Use while ~isequal(a,'yes') You can't compare 'yes' and 'no' using ==, try this 'abc'=='abf' the result is a com...

12 years ago | 0

Answered
replace the rows of a matrix with binary digit values
A=[ 1 1 1 1;2 2 2 2;3 3 3 3;2 2 2 2;3 3 3 3] s=[1 0 0 0;0 1 0 0;0 0 1 0]; out=s(A(:,1),:)

12 years ago | 0

| accepted

Answered
Assigning pixels a negative value
The pixels are not rejected, they just have the same color

12 years ago | 0

Answered
How to accesss the columns of a matrix in a cell array in matlab?
% Example m=4; n=5; A=arrayfun(@(x) rand(m,n),(1:8)','un',0) %-------------------------------------- for k=1:numel(A)...

12 years ago | 0

Answered
Grouping a given matrix into sub matrices
t=linspace(0,0.8,1000)' y=rand(1000,1) idx2=[]; ii=0; idx1=1; t(end+1)=0.81; for k=0.1:0.1:0.8 ii=ii+1; idx2=f...

12 years ago | 0

Answered
please how to inrement a length of the beam by 0.01in this simpl equation this has not given the hand
Maybe you want l=100 for x=1:l+1; for m=1:10 phi(x,m)=sin((x-1)*pi*m/l); end end plot(phi)

12 years ago | 0

| accepted

Answered
How can I replace?
d=uigetdir cd(d);

12 years ago | 1

| accepted

Answered
How to find index using max function to multi array???
A=rand(3,4,2,5); [ii,jj]=max(A(:)); [a,b,c,d]=ind2sub(size(A),jj)

12 years ago | 0

| accepted

Answered
Problem in plotting polar plot from data.
t=0:0.1:10; y=cos(2*pi*t); polar(t,y)

12 years ago | 0

Answered
Sorting into equal sized bins
A=rand(72000,1) B=reshape(A,7200,10)

12 years ago | 0

Answered
I am getting a straight line while running the following code. What is going wrong??
x=0.1:0.001:10; y=exp(-x.^2/2)./sqrt(x); plot(x,y) It's |./| instead of |/|

12 years ago | 0

| accepted

Answered
wind vector arrows color coding
wdir = [45 90 90]; knots = [6 6 8 ]; temp=[10 5 -2]; rdir = wdir * pi/180; [x,y] = pol2cart(rdir,knots); h=compass(x,y);...

12 years ago | 1

Load more