Answered
Error in code (how to run this code by solving the error)?
Don't run the code directly using run button. First define the input variables and then call your function. cls_param = your v...

5 years ago | 1

Answered
How to extract specific rows & columns from a text file
Read about the functions like importdata, load, readmatrix, textscan, readtable. data = importdata(mytextfile) ; iwant = dat...

5 years ago | 1

| accepted

Answered
Straight line through center of polygon
If you have the vertices of the polygon, you can fit a striaght line and draw it. Example: P = [0 0 ; 1 0 ; 1 1 ; 0 1] ; % v...

5 years ago | 0

| accepted

Answered
How to plot the graphs by fixing constants of your choice
You can substitute your value using subs. Read about this function. Also you can plot for range values using fplot. Read about...

5 years ago | 1

Answered
Array indices must be positive integers or logical values.
In MATLAB the indices of array should be strictly positive integers. Zeros and negative numbers are not allowed. This loop in ...

5 years ago | 0

Answered
Finding Coordinates of Multiple Contours
C = cell(40,1) ; H = cell(40,1) for n = 1:40 ; [c,h] = contour(long3,lat3,squeeze(yearly_array2(:,:,n))',[287 287],'y')...

5 years ago | 0

| accepted

Answered
iteration in runge-kutta
clc; clear all ; clc;clear all;close all; H = [0.5,0.1,0.7,0.01] ; a = 0; b = 2; m = length(H) ; T = cell(m,1); W ...

5 years ago | 1

Answered
How can I draw a moving platform
Define a rotation matrix as shown here: https://en.wikipedia.org/wiki/Rotation_matrix and multiple the coordinates with the matr...

5 years ago | 0

Answered
Array of an image
img = dir('*.jpeg') ; % give your extension here N = length(img) ; % number of jpeg images in the folder for i = 1:N...

5 years ago | 0

Answered
How to find specific entry values in a vector?
x = [1, 1, 1, 3, 3 ,3 ,2 ,2, 3, 3, 1, 1, 1 , 3, 3, 2 ,3]; x(x~=3) = 0

5 years ago | 0

Answered
Extract submatrix out of a tilted matrix
Read about inpolygon. This will give you the points which are lying inside the given closed region.

5 years ago | 1

Answered
How to find the average in for loop?
avg = 0 ; for j = 1 : 1 : 10 Ry = max(Y(160 * (j-1) + 1:160*j)) + abs(min(Y(160 * (j-1) + 1:160*j))); avg = avg + Ry ; end...

5 years ago | 0

Answered
Wanna find x that maximize a function including symbolic variables
syms K m T D x f(x)=sqrt(1/( (K-(m+T*D)*x^2)^2 + x^2*(D+T*K-T*m*x^2)^2)) ; df = diff(f,x) s = solve(df,x)

5 years ago | 0

| accepted

Answered
coloring points based on value
You need not to use a loop. You can achieve this by getting the required indices and plotting. Check the beow demo example: x =...

5 years ago | 0

Answered
Converting 0 to Nan in Timetable
If T is your table .. to convert zeros in column 3 into NaN use: T.(3)(T.(3)==0) = NaN ;

5 years ago | 1

| accepted

Answered
Surface Plot using excel file as a source
x = A(1,2:end) ; y = A(2:end,1) ; Z = A(2:end,2:end) ; surf(x,y,Z) ;

5 years ago | 1

Answered
I am trying to convert the cell arrays tables into arrays doubles, as I have 349*1 cell arrays.
Let T be your cell array which has table in each cell. n = length(T) ; iwant = cell(N,1) ; for i = 1:n iwant{i} = tab...

5 years ago | 1

| accepted

Answered
How to fill empty spaces and mark them on plot?
idx = isnan(F); id1 = find(idx) ; id2 = find(~idx) ; % Fill missing F(idx) = interp1(id2,F(id2),id1) ; plot(id1,F(id...

5 years ago | 0

| accepted

Answered
I need average of all elements with same position of cell arrays.
You run a loop for each celll....extract the column you want and find the average using mean. Let A be your cell array of size...

5 years ago | 0

Answered
I Want to convert 2D profile into 3D profile
m = 100 ; n = 100 ; zv = linspace(-20,20,m); phiv = linspace(0,2*pi,n); [zv, phiv] = meshgrid(zv,phiv) ; rv = ones(s...

5 years ago | 0

| accepted

Answered
Three phase sinus wave plotting with degrees
x=linspace(0,2*pi,60); r=sin(x); y=sin(x+2*pi/3); b=sin(x+4*pi/3); xd = x*360/(2*pi) ; plot(xd,r,xd,y,xd,b) grid on, b...

5 years ago | 2

| accepted

Answered
Find repeated values in an array, by column and rows (unique function).
A = [9.04828 8.80036 ; 9.04828 8.80036 ; 9.11259 8.74653 ; 9.04828 8.80036 ; 9.24358 8.74653 ; 8.9823 9.05449 ; 9.02563 8....

5 years ago | 0

| accepted

Answered
Three phase sinus wave plotting
x1=linspace(0,2*pi,60); r=sin(x1); x2 = x1+2*pi/3 ; y=sin(x2); x3 = x1+4*pi/3 ; b=sin(x3); plot(x1,r,x2,y,x3,b) gri...

5 years ago | 0

| accepted

Answered
How to find a value at a certain point/time slot?
t = 0:0.1:10 ; y = exp(t) ; ti = 7 ; yi = interp1(t,y,ti) ; [ti yi]

5 years ago | 1

| accepted

Answered
Reading multiple excel files in sequence
excelFiles = dir('*.xlsx') ; N = length(excelFiles) ; for i = 1:N thisFile = excelFiles(i).name ; T = readtable(thi...

5 years ago | 0

Answered
How to save statistics in the function - image processing
The given error is very clear and simple. The error says, you are trying to extract more number of elements then present from th...

5 years ago | 0

| accepted

Answered
Findind repeated elements in a cell of a Table and report number of cases
Let a be column. xbins = unique(a); [counts,centres] = hist(a,xbins); R = [centres counts']

5 years ago | 0

Answered
modify a row of an array within a function
If a is an array of size m*n, you can repalce i'th row with a row matrix b of size 1*n using: a(i,:) = b ;

5 years ago | 0

Answered
How do I incorporate meaningful colorbar/colormap in a 2D plot; Having a matrix size [83,25000]
yy = rand(83,25000) ; x = 1:size(yy,1) ; y = 1:size(yy,2) ; pcolor(x,y,yy') ; shading interp colorbar

5 years ago | 0

| accepted

Answered
2nd order gradient
Let b be your N*1 vector and f be your function values evealuated and of size N*1. df = gradient(f,b) ; % first derivative ...

5 years ago | 1

Load more