How to replace some Number in row matrix with NaN
Y = [5 7 18 16 40 18 9 32 15 4 9 60 40 24 10 13]; Y_new = [5 7 18 16 NaN 18 9 NaN NaN 4 9 NaN NaN NaN 10 13]; dY = diff([...

9日 前 | 0

How to do iteration?
Lch=[-22.5971212295960 29.9076428426283 -17.3150512249935 16.1986770081474 -29.0533677411566 39.4388257818327 -23.4478195797575 ...

9日 前 | 0

nearest neighbour, bilinear, and bicubic interpolation

9日 前 | 0

| 採用済み

Open and procces multiple images
Img = dir('*.png') ; % give your extension of images N = length(Img) ; for i = 1:N thisImg = Img(i).name ; I = i...

9日 前 | 0

Imaginary parts of complex X and/or Y arguments ignored
plot(i, lambda); The above line is not correct. LAst lines should be repalced with. H=B./mu; figure (2) plot (H,B); xlabel...

9日 前 | 0

Define time interval for wave of highest peak
Use the function max, it will give maximum value along with the index of the maximum value; using this index you can get the res...

9日 前 | 0

What is difference between corrcoef([A B]) and corrcoef(A, B)?
Both are same and result into same answer. A = randn(60,1); B = randn(60,1); R1 = corrcoef(A,B) R2 = corrcoef([A B])

9日 前 | 1

| 採用済み

Dividing image into grid - imwrite breaks when processing an empty image
Error is clear right..it seems there is no data in ca{r,c} in the case when error pops. Keep a check whether data is empty or no...

9日 前 | 0

| 採用済み

How to smoothen curves?
load('data') x = data(:,1); y = data(:,2:end); figure(1), plot(x, y,'r'); yi = zeros(size(y)) ; for i = 1:size(y,2) ...

10日 前 | 1

Get values of workspace with same matrix format.
You can simply use B(:); this will always give the result as column matrix. If you want to use if, else if size(B,1)==1 fp...

10日 前 | 0

How do I separate negative datas with their row?
Let H be your third column. idx = H<0 ; % get all negative values logical indices lon1 = lon(idx) ; lat1 = lat(idx) ; H1...

10日 前 | 0

| 採用済み

Find intersection points between lines
You can consider using this file exchange to find the point of intersections. https://in.mathworks.com/matlabcentral/fileexcha...

10日 前 | 1

| 採用済み

Plotting for loop with two outputs
X= 2:1000000; n = length(X) ; L = zeros(1,n) ; for i = 1:n L(i) =HW32P12Function(X(i)); end figure(1) loglog(X,L) ...

10日 前 | 0

| 採用済み

How can I draw and descretize(into grids or mesh) this domain in 2D.
You can use transfinite interpolation. Refer the below examples: https://in.mathworks.com/matlabcentral/fileexchange/40618-gri...

13日 前 | 2

| 採用済み

Find min and max values in a constant interval.
If A is your complete matrix. t = A(:,1) ; % this is seconds column iwant = A(t==30,:) ; % extract chunk which is for 30 ...

13日 前 | 0

How to fix the Dot indexing is not supported for variables of this type error?
Replace (i.j) with (i,j). There is . (dot) between i and j; replace it with comma. it seems a typo error.

13日 前 | 1

Plot3 to import data from Excel

13日 前 | 0

How to save the values of (x,C) in file 1 and (x,y) in file 2 to plot them in file 3.. the description in the code below
% file 1 clc; clear; x=[1 3 2 5 8] ; C = zeros(10,length(x)) ; for i=1:10 C(i,:)=i*x; end writematrix(C,'file1.txt...

13日 前 | 0

| 採用済み

how to find specific value in a table?
idx = hsl.clusternya==3 ; % logical indexing T(idx,:)

13日 前 | 1

| 採用済み

If statement to target certain area of f(i,j)?
% Subroutine function k=X(x,y,dx) if (x <=5 && y <=2) || (x >= 10 && y >= 10) constant = 85; % beta else constant ...

13日 前 | 0

| 採用済み

help --- symbolic expression or function
syms x y z one = 3*x +2*y - z == 10; two = -x + 3*y + 2*z == 5; three = x -y - z == -1 ; s = solve({one,two,three},x,y,z) ; ...

13日 前 | 1

How to add (combine) together two structures with the same fields?
clc; clear ; s1.name = 'Tom' ; s1.sex = 'm'; s1.age = 25 ; s2.name = 'Harry' ; s2.sex = 'f'; s2.age = 26 ; % Structur...

13日 前 | 0

| 採用済み

I'm plotting a solution to a PDE using surf but the graph turns out wrong?
MAy be you are looking for this: n=1:10 ; tRange = 0:0.05:1; [n,t] = meshgrid(n,tRange); u = (4./(n.^3*pi^3)+(4...

14日 前 | 0

14日 前 | 0

Plot data with date and time
thedates = datetime(datestr((x))); y = str2double(y) ; plot(thedates,y)

14日 前 | 1

| 採用済み

load a folder of excel files
excelFiles = dir('*.xlsx') ; N = length(excelFiles) ; for i = 1:N file = excelFiles(i).name ; T = readtable(file) ;...

14日 前 | 1

| 採用済み

Calculate differences between all values elements in a vector and increase max diff by one
A = [2 3 1 4] ; B =[4 4 2 4]; AB = B-A ; [val,idx] = max(AB) ; A(idx) = A(idx)+1

14日 前 | 1

| 採用済み

merge duplicate entries and take average associated columns
A=[1 1 1 2 2 3 3 3 4 4 4 2 2 2 3 ]; % B = [ 1 2 3 4 2 3] B= A(diff([0 A])~=0)

14日 前 | 0

discrete line plot in matlab 2015?
Replace those values with NaN and plot: A =[1 0.122 0.05 0.093 0.113 6 0.18 0.071 0.135 0.168 10 NaN NaN NaN NaN ...

14日 前 | 0

| 採用済み

Hello everyone, how to record and save the coordinates of each image centroid point in a matrix in 'for loop'. Thank you very much. The code is as follows:
centroids = cell(numberOfFrames ,1) ; for i = 1:numberOfFrames centroids{i} = s.Centroid; end

14日 前 | 0

| 採用済み