Community Profile # Chunru

Last seen: Today Active since 2013

Matlab user since 1990

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

How to convert negative numbers in parentheses (bank-formatted text) to numbers with minus sign?
xbank = [" (1,234)" "2,345,678" "(1,234.56)"] x = arrayfun(@bank2double, xbank) function x = bank2double(s) s...

4 dagen ago | 0

| accepted

Combine mat files into one, then combine all variables into one
filename = ["abc001.mat" "def002.mat"]; % list of the files in order variable1all = []; variable2all = []; for i=1:leng...

7 dagen ago | 0

there is nan in a column, delete the whole row
idx = isnan(c.lagpe); % find the index of nan c(idx, :) =[]; % remove the rows from table

7 dagen ago | 0

| accepted

How can I automate a process for n times?
J = [14 0 0 0 0; 15 0 0 0 0; 16 16 16 0 0; 22 22 0 0 0; 24 24 0 0 0; 25 25 25 25 25] Lr = size(J,1); for i = 1:Lr row = J...

8 dagen ago | 1

Program code for convolution
u = [1 2 3 1]; v = [2 3]; conv(u, v) % filter(u, 1, v)

8 dagen ago | 0

plotting a surface on a cylinder top face
theta =0:0.01*pi:2*pi; r=0.8; x=r*cos(theta); y=r*sin(theta); z=zeros(size(x)); % simple patch for base p_base =patch(x,...

9 dagen ago | 0

How to remove cell data from specific column using dates as a reference?

9 dagen ago | 0

combine two cell into one string

10 dagen ago | 0

| accepted

Echo+noise signal
% generate a waveform f0 =100; fs=1000; pw = 0.1; pri = 1; npulses = 10; s = cos(2*pi*f0*(0:1/fs:pw))'; % it can be ...

10 dagen ago | 1

| accepted

Spectogram Of I and Q data
x = xi + 1i*xq; spectrogram(x)

10 dagen ago | 0

Transfer Quarterly dates to Monthly
% Your data dtstr = ["31/3/1992" "30/6/1992" "30/9/1992" "31/12/1992"]; x = [1.2 1.3 1.4 1.5]...

10 dagen ago | 0

| accepted

What is the training accuracy of this model?
If Labels is character array instead of string array, then numel(Labels) will give the number of characters instead of the numbe...

11 dagen ago | 0

| accepted

Get coordinates points inside a 3-D circle in MATLAB
normal=[-3.5556 -0.2222 1.0000]; center=[138 146 219]; radius=3; plotCircle3D(center,normal,radius); hold on point = p...

11 dagen ago | 0

How can I label multiple routes on a geoscatter plot?
fig = figure; %pos = fig.Position; %files = dir('cast*.gpx'); for i = 1:5 %length(files) %filename = files(i).name; ...

13 dagen ago | 0

| accepted

operation on single elements in MATLAB
x=-2:1:2; %coordinates x y=x.^2; %coordinates y z=[x;y] d = diff(z, 1, 2) % diff along 2nd dim d = vecnorm(d...

14 dagen ago | 1

specifying frequencies in pwelch not working
No problem for on-line matlab. data = randn(20000,1); %assume this is 1 row of my EEG data of interest analysisWinSize = 1000...

14 dagen ago | 0

Create duration array template
ti = duration('00:00:0.00','Format','hh:mm:ss.SSS'); tf = duration('02:00:0.00','Format','hh:mm:ss.SSS'); interval = millise...

14 dagen ago | 0

| accepted

Multiply values in array by *-1
a = randn(1, 106); a(14:20) a(16:18)=-a(16:18); a(14:20)

14 dagen ago | 0

| accepted

How to find sum of previous 5 numbers in a column..
x = [56 45 56 678 678 568 2 3 4 5]; y = filter(ones(5,1), 1, x) y1 = y(5:end)

14 dagen ago | 0

| accepted

Graph function problem Incorrect values
What's wrong? x=[0:50]; y=-x.^3+3*x.^2+2*x-27; plot(x,y)

14 dagen ago | 0

| accepted

How to reduce running time of diagonal matrix multiplication with full matrix in Matlab?
n = 2000; d=500; B = randn(d, n); dv = randn(n, 1); D = diag(dv); % Normal tic A = B*D*B'; toc % Speed up 1 tic C = ...

14 dagen ago | 0

| accepted

How to make a number NaN when its both neighbours are NaN?
A = [NaN 2.35 NaN 2.358 1.68 1.98 2.88 NaN 2.68 NaN 2.70 NaN 2.20 NaN 3.03; NaN NaN 2.77 NaN 2.67 1.87 2.56 1.88 2.39 NaN...

15 dagen ago | 0

| accepted

adding an if condition so the negative value would be set to zero
for i=1:length(t) DOD(i)=cumsum((T(i)*30)/(3600*14.6)); end DOD = max(DOD, 0)

15 dagen ago | 0

Circular bar graph in matlab
% Some data T.Country = string(('A':'Z')'); T.Population = randi([1000 10000], size(T.Country)); T = struct2table(T); n = he...

15 dagen ago | 1

Plot with break in curve
xy=[0.0000 -963.0477 0.0043 -961.9818 0.0085 -960.8602 0.0128 -959.6834 0.0171 -958.4515 0.0214 -957.16...

15 dagen ago | 0

removing the pixels with different size and unregular shape
A simple approach is to find the regions you want to deleted (assign 0). Four your question, rectangle regions are sufficient: ...

16 dagen ago | 1

How to plot like this graph?
% [1 2][3 4] % [6 7] h(1) = subplot(2, 4, [1 2]); % 4x2 grid, 1st subplot plot(randn(10, 1)); h(2) = subplot(2, 4, ...

16 dagen ago | 0

| accepted

Error using mesh Z must be a matrix, not a scalar or vector. Error in untitled6 (line 5) mesh(W,Y,Z)
w = 200:50:450; y=120:30:240; [W,Y] = meshgrid(w,y); Z= 64.0189+1.4629*W-2.626*Y-0.0012*W.^2+0.0098*W.*Y+0.0082*Y.^2; whos ...

16 dagen ago | 0