Answered
could anyone help me to overcome the error in following code:
Read about unique and sort. The term descend should be for sort. function y=maxk(A,3) A=sort(unique(A),'descend') y=A(1:3) e...

7 years ago | 0

Answered
Plot ellipsoid between two points
https://in.mathworks.com/matlabcentral/answers/86615-how-to-plot-an-ellipse

7 years ago | 0

Answered
Compare the number of elements in each row of 2 cell arrays (A and B) and determine which array contains minimum number of elements for that row and save them.
If A and B are your cell arrays. You can get the required count of non-empty cells using: A_count=sum(~cellfun(@isempty,A),2...

7 years ago | 0

Answered
Area calculation for patches
I = imread('capture1.jpg'); [L,N] = superpixels(I,100); figure BW = boundarymask(L); imshow(imoverlay(I,BW,'cyan'),'Initia...

7 years ago | 1

| accepted

Answered
How to store values to the matrix and retrieve later as shown below ?
YOu can further reduce the variables: m = 10 ; L = zeros(m,1) ; J = zeros(m,1) ; x = 1:0.1:m ; for i = 1:length(x) ...

7 years ago | 0

Answered
image rotation by application of a 2D rotation matrix
You cannot work like that...you need to get locations of pixels and then multiply these locations to the rotation matrix. YOu ma...

7 years ago | 0

Answered
How do I pre-allocate memory for a structure?
S = struct ; for i = 1:10 S(i).Rand = rand ; S(i).loop = i ; end

7 years ago | 0

| accepted

Answered
3-D graphing
First define the dimensions i.e length L, breadth B and number of points on length, breadth m,n. USe linspace to discretize L a...

7 years ago | 0

Answered
Check if a number in a matrix's first column exist. If yes then keep that entire row in a separate matrix
A = [ 9 8.1600 8.1700 16 12.3600 12.3600 23 40.6900 27.0000 30 5.6600 103.4100 9 25...

7 years ago | 0

| accepted

Answered
Split vector A into smaller vectors based on vector B
data = [1.2 1 1.3 1 1.4 1 1.5 2 1.6 2 ...

7 years ago | 0

Answered
logical index replace values
Read about logical indexing. idx = 0 < output5 & output5 < 1 ; output = output5(idx);

7 years ago | 0

Answered
Adding a polyshape to a 3D plot (a la patch)
load('example.mat') Hpgon = plot(pgon); axis equal vertices3D=pgon.Vertices; vertices3D(:,3)=0; faces3D=1:size(vertices3D,1)...

7 years ago | 0

Answered
Spline to optimize the curve
c = [ 2.0000 2.0000 2.2703 1.6902 4.7244 7.6318 12.0984 9.1030 12.0000 10.0000 ] ; x = c(:,1) ; y = c(:,2...

7 years ago | 0

| accepted

Answered
plot coordinates in the center of grid
xy = [ 11.2871990000000 75.8008150000000 11.2826320000000 75.8033060000000 11.2648170000000 75.8115220000000 11.287192000000...

7 years ago | 1

| accepted

Answered
How can I generate an .stl file from a symbolically generated 3D surface?
syms u v x = (-2/15)*cos(u)* (3*cos(v) - 30*sin(u) + 90*(cos(u))^4*sin(u) - 60*(cos(u))^6*sin(u) + 5*cos(u)*cos(v)*sin(u)) y =...

7 years ago | 0

| accepted

Answered
Finding the angle between lines that Ive plotted
YOu have multiple ways to do this. Refer below: https://in.mathworks.com/matlabcentral/answers/78195-how-to-measure-angle-be...

7 years ago | 0

| accepted

Answered
Stop the execution with a certain number of second
t1 = tic ; while t1 t2 = toc(t1) ; if t2 > 10 fprintf('loop breaked because 10 seconds passed\n') ...

7 years ago | 0

Answered
index exceeds matrix dimension,Subscript indices must either be real positive integers or logicals
v1(1,t+dt1)=((((-a1)^2)*v1(2,t+dt1))/(h1(2,t+dt1)-h1(1,t+dt1))*g-a1^2) In the above I could say that dt1 is a fraction...and yo...

7 years ago | 0

| accepted

Answered
How can I interactively add info to plots, e.g. name of a curve?
x = rand(10,1) ; y = rand(10,1) ; plot(x,y,'.r') ; [px,py] = getpts() ; % double click on a point when prompts text...

7 years ago | 0

Answered
How to filter the required coordinates which consist with same elevation?
filename = 'elevations.nc'; elev = ncread(filename, 'elevation')'; lon = ncread(filename, 'lon')'; lat = ncread(filename, '...

7 years ago | 1

| accepted

Answered
Reading all the .wav files from a particular folder
files = dir('*.wav') ; N = length(files) ; for i = 1:N thisfile = files(i).name ; % do what you want end

7 years ago | 1

Answered
griddata not creating a smooth interpolation
Try scatteredinterpolant. Tmod=[50 100 150 175 200 240 245 245 245 245 245 245 245 245 230 200 150 125 110...

7 years ago | 0

Answered
How to put hat over a greek symbol express its value in legend of a plot?
Read here: https://in.mathworks.com/help/matlab/creating_plots/greek-letters-and-special-characters-in-graph-text.html

7 years ago | 0

Answered
How can I create a 2D plot using a parfor loop?
YOu cannot see the plot..but you can save it and late access it. L1 = 10; L2 = 5; L3 = 3; theta1 = (0:5:90); theta2 = (0...

7 years ago | 0

Answered
how to check whether a particular file is there in the datastore or not?
Read about exist, contains , strcmp

7 years ago | 0

| accepted

Answered
Array indices must be positive integers or logical values (image processing)
I=x(i,j); % here I will be pixel value of image, it cannot be a index x(i,j)=xL(I)+( L(I)*lambda(i,j) ); Note that in MAT...

7 years ago | 0

| accepted

Answered
problem in writing code
YOu have typed lambda wrong...typo error. delta=0.02; lambda=[0.01: 0.001 : 0.1]; p= lambda./delta; q1=delta-lambda+lam...

7 years ago | 1

| accepted

Answered
Check if vector is increasing monotonely or just increasing
Refer here: http://matlabtricks.com/post-29/pattern-search-example-monotonically-increasing-or-decreasing-subset YOu should re...

7 years ago | 0

| accepted

Load more