Community Profile

photo

Chunru


Last seen: Today Active since 2013

Matlab user since 1990

Statistics

All
  • MATLAB Central Treasure Hunt Finisher
  • 6 Month Streak
  • Pro
  • Number Manipulation I Master
  • Indexing I Master
  • Knowledgeable Level 4
  • Revival Level 1
  • Commenter
  • Sequences And Series II Master
  • Speed Demon
  • Creator
  • Sequences And Series I Master

View badges

Content Feed

View by

Answered
Removing commas between columns in text data
test = {'Sometimes, ,, I, use, commas, .' 'I, like, writing, ,, I, like, reading'}; test = regexprep(test, ',\s', ' ') ...

6 hours ago | 0

Answered
Show limited digits numbers.
You can use fprintf with format specifier to format the print out. "doc fprintf". A=2.54357766; fprintf('%.6f\n', A);

6 hours ago | 0

Answered
Change string words to number in table
% Assume the column has the data x.omst=["Clouds"; "Rain"; "Clear"] % You can use the categorical data x.omst = categorical(x...

23 hours ago | 0

| accepted

Answered
Deleting unnecessary values in numerical array
% Assume that your data in second column is sorted. x = [ 1420 1 1410 1 1400 1 1390 0.9 1380 0.8 1370 0.7 1300 0 1290 0...

23 hours ago | 0

| accepted

Answered
99x99 matrix
% For time comparison: n = 1000; timeit(@() bidiag1(n)) timeit(@() bidiag2(n)) timeit(@() bidiag3(n)) function bidiag1(n)...

1 day ago | 0

Answered
99x99 matrix
n = 9; %99 A = eye(n); A(n:n-1:n*n-1) = 1; % anti-diagonal A

1 day ago | 0

Answered
How can I generate a square lattice undirected graph?
n = 10; A = delsq(numgrid('S',n+2)); G = graph(A,'omitselfloops'); h = plot(G); h.XData = floor((0:99)/10); h.YData = rem((...

1 day ago | 0

| accepted

Answered
add an line for the coasts of the continents used for the geodensityplot in the mapping toolbox
mapping toolbox has the convention of lat-lon coordinates rather than lon-lat. try the following in your code: lon = linspace(...

1 day ago | 0

| accepted

Answered
How can I add more colors to semilogy?
plot(rand(30,20)+(1:20)); % plot 20 lines legend % The following line will change the default ColorOrder (7 colors) % change...

3 days ago | 0

Answered
how to change the front size and the inclination in a bar graph
h = gca; h.XTickLabelRotation = 0; % not recommended for long string h.TickLabelInterpreter = 'none';

4 days ago | 0

Answered
How do i remove conj from differention?
clear all syms x v s a y z r t real syms x(t) y(t) assumeAlso([y(t),x(t)],'real') A=[x, diff(y(t),t), s; y, z, r; s x(...

5 days ago | 0

| accepted

Answered
How to change the values of both axes
%Define variables sigma = 35*10^6; young_modulus = 90*10^9; strain_coefficient = 6*10^-9; magnetic_field = linspace(0, 16000...

5 days ago | 0

Answered
Selecting files from a directory
sims = pwd; %uigetdir ('C:\Matlab') save test.in sims % create a file info = dir(fullfile(sims,'*.in')) list = {info(~[info...

5 days ago | 0

| accepted

Answered
fit function does not work correctly
If the StartPoint is good enough, you can get the correct fitting. t = [0:0.01:6]'; %Test with a cosinus function y = cos(t*3...

5 days ago | 0

Answered
Display values of each element in imagesc
c = randi([0 40], [16 16]); heatmap(c); colormap(jet(512))

5 days ago | 0

| accepted

Answered
How to plot this frequency graph?
load runoff load precipitation precipitation = normalize(precipitation, 'range'); runoff = normalize(runoff, 'range'); histo...

6 days ago | 1

| accepted

Answered
How can I extract the values form the cell array?
Obviously, you don't have a matlab cell array (is it a python array?). The matlab array may look like the following: a(1).name...

6 days ago | 0

| accepted

Answered
Find the index of a value closest to a constant value in 3D array when the index of row and column are given
B(:,:,1) =[ 1 2 4 2 7 8 9 0]; B(:,:,2) =[ 9 2 4 7 0 1 2 ...

7 days ago | 0

| accepted

Answered
Sparse Matrix with Same number of non-zero values in each column
A = createMatrix(8, 4); full(A) function A = createMatrix(n, k) A = sparse(n,n); for i=1:n A(randperm(n, k), i) = 1/k; ...

7 days ago | 0

| accepted

Answered
Displaying frames captured by getframe(h) at original size
You can use "imshow" which by default show images in 100% magnification. "doc imshow" for more details.

9 days ago | 0

| accepted

Answered
using imagesc to plot a matrix of data
%C = 0.1:0.1:0.2; C = [0.1 0.2]; % There are only two points along x F = 0.1:0.1:0.5; figure(1) subplot(1,3,1) mean_GT...

9 days ago | 0

| accepted

Answered
How to create a circle filled with equidistant points inside it?
Here is a sub-optimal (or almost optimal) solution. Filled dots will form the hexagonal formation. radius = 10; d = 1; % dis...

9 days ago | 0

| accepted

Answered
How I plot a matrix wich each rows is a different curves on the graph?
a = randn(6, 21); plot(a')

10 days ago | 0

| accepted

Answered
How to Convert Magnitude(g/N)/Phase (degrees) data in to Complex Receptance (m/N)
x =[0.00000e+000 1.16597e+002 -1.80000e+002 3.12500e-001 9.33462e+001 5.02240e+001 6.25000e-001 ...

11 days ago | 0

Answered
3D Plot of a Matrix with only Char data type
x= {'USA', 'Germany', 'South Africa', 'China', 'Mexico', 'Australia'}; y = {'America', 'Europe', 'Africa', 'Asia', 'South Amer...

11 days ago | 0

Answered
Massive time required for pdist
%tic X = rand(1000,2); Y = rand(1000,2); % fprintf('Time for array creation: '); %toc %% Version 1 tic j=1; for i = ...

12 days ago | 0

| accepted

Answered
How to arrange the constraints shape to A matrix and b constants automatically ( Ax <= b)??
% Let x = [x1; x2; x3; x4] % x1 + x2 <= x3 + x4 + 1 ; % constraint 1 % => [1 1 -1 -1]*x <= 1 % X3 <= x1 + 10 ; % cons...

14 days ago | 0

Answered
Array of Structures to Structure of arrays
% array of structure M = 5; for i=1:M a(i).f1 = rand(1,1); a(i).f2 = rand(1,1); end a a(1) % struncrure of arr...

15 days ago | 0

Answered
How to detect and delete similar value rows in Matlab?
A =[1 2 3 4; 1 3 4 2; 1 4 2 4; 1 3 2 2]; % For columns with the same values i = find(all(diff(A, 1)==0, 1)); ...

17 days ago | 0

Answered
How to collect output matrix from for loop
If you want to accumate over different matrices n = 10; A = zeros(3, 3) for i=1:n A = A + randi(5,3,3); end A If you ...

17 days ago | 0

| accepted

Load more