Answered
I am getting directory problem
It is not a directory problem. Your code which your running is in a different folder and presently you are in different folder. ...

3 years ago | 0

Answered
Find the maximum 5 day total in a year
% create time stamps from 1992 to 2020 thedates = (datetime(1992,1,1):days(1):datetime(2020,12,31))' ; idx = thedates.Day==29 ...

3 years ago | 0

| accepted

Answered
Combine different size matrix
A = [1 1 1;1 1 1;1 1 1]; B = [2 2 2;2 2 2]; C = [3 3 3]; D = 4; iwant = [diag(repmat(D,1,4),2) vertcat(A,C,B)] ; iwant([5 1...

3 years ago | 0

Answered
cropping multiple images in the folder automatically using imcrop with same cropping area
fpath = 'C:\Users\Admin\Documents\MATLAB\DIC Challenge 1.0/EXAMPLE_SAMPLE' ; numFiles = numel(FileNames); % no of images 12 f...

3 years ago | 2

| accepted

Answered
How to get the 1×1 cell array?
offset = -20; pos = 10; neg = 5; str = {['m, ', num2str(offset+pos),',', num2str(offset+neg), ' L ', num2str(-neg+0.3),',', '...

3 years ago | 0

| accepted

Answered
Matlab error when evaluating a neural network
These lines: YPred = net(XTest')'; YPred = tree.ClassNames(YPred); nnAccuracy = mean(YPred == YTest); fprintf('Neural networ...

3 years ago | 0

Answered
I want a matlab code for plotting conic sections.
You may refer to this: https://in.mathworks.com/matlabcentral/fileexchange/33610-a-tour-of-parametric-equations

3 years ago | 0

Answered
How to increase a symbol in a row matrix?
n = 4 ; syms a [1 n] ; a

3 years ago | 0

| accepted

Answered
If any of the matrix element or elements value is 1 or greater than 1 , then how can I delete that row or rows from a (M * N) matrix ?
A = [2 4 1; 4 5 2 ; 2 4 1 ;3 1 3; 2 6 3] ; idx = any(A==1,2) ; A(idx,:)=[]; A

3 years ago | 0

| accepted

Answered
How to insert a new line before a character in file?
str = '$text-text-text-text-text-text$text-text-text-text-text-text-text$text-text-text-textc' s = strsplit(str,'$') ; s'

3 years ago | 0

Answered
Colors above a level is not shown in a contour plot
[X,Y,Z] = peaks(100) ; [c,h] = contour(X,Y,Z,[6 6]) ; % arrange the contour c(:,1) = NaN ; % plot contourf(X,Y,Z,'EdgeCol...

3 years ago | 0

Answered
Scan image and crop it to certain size
I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1243147/image.png') ; [y,x] = find(I) ; % Get b...

3 years ago | 0

Answered
How to draw a variable width line?
qnum = 300 ; X = linspace(0,2*pi,qnum); Y = sin(X); qsp = 10; qz = round(linspace(1,qsp,qnum-1)); figure hold on for...

3 years ago | 1

| accepted

Answered
generate uniformly distributed coordinates (Ax3 matrix) from known coordinates (Rx3 matrix)
Read about griddata, scatteredInterpolant

3 years ago | 0

Answered
I am trying to do a scatter plot with 2 different Y axes with different scales using imported data on a graph.
x1 = rand(1,10) ; y1 = rand(1,10) ; z1 = sqrt(x1.^2+y1.^2) ; yyaxis left scatter(x1,y1,[],z1,'filled','O') x2 = x1; y2 = r...

3 years ago | 1

Answered
How can i obtain this using matlab?
b = [0.8 -1 1] ; a = [1 -1.2 0.4] ; [A,B,C,D] = tf2ss(b,a)

3 years ago | 0

| accepted

Answered
Finding the first intersection point between 2 lines
Try this: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections

3 years ago | 0

Answered
Plot a function with an specific colour asociated to each data
x = linspace(0,2*pi)' ; y = sin(x) ; z = y ; % Plot data: surf([x x], [y y], [z z], 'FaceColor', 'none','EdgeColor', 'inter...

3 years ago | 1

Answered
How to find vertices of triangle approximated from binary image
I = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1239812/image.png') ; [y,x] = find(I) ; mx = m...

3 years ago | 0

Answered
How to store corresponding data whenever zero comes in that column from excel sheet?
LEt A be your data/ matrix and you want to check 0's in the first column. iwant = A(A(:,1)==0,:)

3 years ago | 0

Answered
How can I get a cross section of a contour plot?
REad about interp2, scatteredInterpolant.

3 years ago | 0

Answered
Integrating a 2D image plotting with non-uniform mesh(spacing)
load('P_0_swg.mat') x = lum.x ; y = lum.y ; Z = lum.z ; [X,Y] = meshgrid(x,y) ; xi = linspace(min(x),max(x),200) ; yi =...

3 years ago | 0

| accepted

Answered
How to convert datetime to day of the year when there are more than one year?
Read it here: https://in.mathworks.com/help/matlab/ref/datetime.day.html

3 years ago | 0

| accepted

Answered
3D plot where x and y has different length
For a 3D plot (x,y) can have different lengths, if you are talking about pcolor, surf. HEre you are plotting a surface. x = li...

3 years ago | 0

| accepted

Answered
Obtaining n^th order polynomial combinations in an array
REad about nchoosek You may also refer to the below file exchange: https://in.mathworks.com/matlabcentral/fileexchange/9029-nmu...

3 years ago | 0

Answered
I need to find occurences when the value in a array goes below a level.
Let t be your time array and a be your data. % count number of 0 tol = 10^-5 ; idx = abs(a)<=tol ; % get the indices of 0'...

3 years ago | 0

Answered
Excel Data in Matlab
Read about readtable. Using this import data from excel to MATLAB workspace and than use plot.

3 years ago | 0

| accepted

Answered
How to print most repeated Value in MATLAB
a = [1 2 2 2 3 3 4 4 4] ; [c,ia,ib] = unique(a); C = accumarray(ib,1) ; [c' C]

3 years ago | 0

Answered
Sine function in 2D
x = linspace(0,2*pi) ; y = x ; [X,Y] = meshgrid(x,y) ; Z = sin(X) ; surf(X,Y,Z)

3 years ago | 1

| accepted

Answered
How to replace value if it is multiple of other Value
A = [3 4 5 9] [A0,idx0] = min(A) ; [A1,idx1] = max(A) ; if ~mod(A1,A0) A(idx1) = A0 ; end A

3 years ago | 0

| accepted

Load more