Answered

How to add text to a line in the plot?

If they are horizontal lines, you can use function <https://www.mathworks.com/help/matlab/ref/yline.html yline> By using this...

How to add text to a line in the plot?

If they are horizontal lines, you can use function <https://www.mathworks.com/help/matlab/ref/yline.html yline> By using this...

4 meses ago | 0

| accepted

Answered

How to get the MathWorks documentation in chinese?

Select the Chinese website with Simplified Chinese at the bottom of the website. Then you can find the translated documentation...

How to get the MathWorks documentation in chinese?

Select the Chinese website with Simplified Chinese at the bottom of the website. Then you can find the translated documentation...

4 meses ago | 0

Answered

Error when selecting variables from an Excel sheet

Better to define the Variable Names already in the spreadsheet as follows: opts = spreadsheetImportOptions("VariableNamesRange"...

Error when selecting variables from an Excel sheet

Better to define the Variable Names already in the spreadsheet as follows: opts = spreadsheetImportOptions("VariableNamesRange"...

4 meses ago | 0

| accepted

Answered

how to save plot with its background color without the gray color

b_col = [255, 150, 0]; % orange color code b_col = b_col./255; f = figure; f.Color = [1 1 1]; % Set the...

how to save plot with its background color without the gray color

b_col = [255, 150, 0]; % orange color code b_col = b_col./255; f = figure; f.Color = [1 1 1]; % Set the...

4 meses ago | 0

| accepted

Answered

Argument of max values of multiple 2D arrays

A1 = [1000 25;3 258]; A2 = [1 30;247 259]; C = 10*(A1>A2) + 20*(A2>A1)

Argument of max values of multiple 2D arrays

A1 = [1000 25;3 258]; A2 = [1 30;247 259]; C = 10*(A1>A2) + 20*(A2>A1)

4 meses ago | 0

Answered

How to change axes in tiledlayout with different x and y axes

In order to set the limits, use the following ax1.XLim = [XAxislow XAxishigh]; ax1.YLim = [0 400]; instead of ax1.XLimit...

How to change axes in tiledlayout with different x and y axes

In order to set the limits, use the following ax1.XLim = [XAxislow XAxishigh]; ax1.YLim = [0 400]; instead of ax1.XLimit...

4 meses ago | 0

| accepted

Answered

How adding second grid and values in stackedplot

Set the YLim and YTick for that particular axis. X = 0:4:20; Y = randi(5,6,3); f = figure; s = stackedplot(f,X,Y); s.GridVi...

How adding second grid and values in stackedplot

Set the YLim and YTick for that particular axis. X = 0:4:20; Y = randi(5,6,3); f = figure; s = stackedplot(f,X,Y); s.GridVi...

4 meses ago | 0

Answered

Scatter matrix of probability of occurrence

You may use function hiscounts2 rawdata = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/963270/Wav...

Scatter matrix of probability of occurrence

You may use function hiscounts2 rawdata = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/963270/Wav...

4 meses ago | 1

| accepted

Answered

How to define a colormap easily

Use Colormap Editor by typing 'colormapeditor' in the Command Window. You may also define your own colormap easilty.

How to define a colormap easily

Use Colormap Editor by typing 'colormapeditor' in the Command Window. You may also define your own colormap easilty.

4 meses ago | 1

| accepted

Answered

Struggling with hold on and hold off placements

How about this? L = 2 ; g = 9.81 ; Theta_0 = pi/3 ; % Equations for pendulum p = 2*pi*sqrt(L/g); t = 0:(1/30):2.837 ; The...

Struggling with hold on and hold off placements

How about this? L = 2 ; g = 9.81 ; Theta_0 = pi/3 ; % Equations for pendulum p = 2*pi*sqrt(L/g); t = 0:(1/30):2.837 ; The...

4 meses ago | 0

| accepted

Answered

Change Datetime 'yyyy.MM.dd HH:mm:SSS' to 'HH:mm:SSS'

use function <https://www.mathworks.com/help/matlab/ref/datetime.timeofday.html timeofday>

Change Datetime 'yyyy.MM.dd HH:mm:SSS' to 'HH:mm:SSS'

use function <https://www.mathworks.com/help/matlab/ref/datetime.timeofday.html timeofday>

4 meses ago | 0

| accepted

Answered

How to remove country boundaries from map?

Just use the default one geoscatter([10 55], [80 140], 18, 'filled', 'r')

How to remove country boundaries from map?

Just use the default one geoscatter([10 55], [80 140], 18, 'filled', 'r')

5 meses ago | 0

Answered

How to loop over table to caluclate averages?

Check the following: B: quarterly ratios C:annual ratios D:overall average ratio for an arbitrary period rawdata = readtable...

How to loop over table to caluclate averages?

Check the following: B: quarterly ratios C:annual ratios D:overall average ratio for an arbitrary period rawdata = readtable...

5 meses ago | 0

| accepted

Answered

How to display text in the same line after processing?

Somthing like this? fprintf('Processing xyz file .....'); a = rand(10000,10000); fprintf('done')

How to display text in the same line after processing?

Somthing like this? fprintf('Processing xyz file .....'); a = rand(10000,10000); fprintf('done')

5 meses ago | 1

Answered

How to do simultaneous flickering of two straight line plots

Use function timer to set one timer for plot a and the other for plot b. Attahced please find the function and you can run it t...

How to do simultaneous flickering of two straight line plots

Use function timer to set one timer for plot a and the other for plot b. Attahced please find the function and you can run it t...

5 meses ago | 0

| accepted

Answered

Can I add unknown number of check boxes in live editor?

Suppose your data is a cell array, update your uitable by the following: uit.Data = [data,num2cell(false(size(data,1),1))]; % ...

Can I add unknown number of check boxes in live editor?

Suppose your data is a cell array, update your uitable by the following: uit.Data = [data,num2cell(false(size(data,1),1))]; % ...

5 meses ago | 0

Answered

Putting NULLs in between the string array.

Hope I understand it correctly, try this: A={'a','b','c','d','e'}; index=[1,3,5]; newindex = index+(0:length(index)-1); N = ...

Putting NULLs in between the string array.

Hope I understand it correctly, try this: A={'a','b','c','d','e'}; index=[1,3,5]; newindex = index+(0:length(index)-1); N = ...

5 meses ago | 1

| accepted

Answered

Why am i getting 'Array indices must be positive integers or logical values" when trying to plot this function?

Remove the x1, otherwise it becomes the index of the varaibles f1,f2 & f3 where index must be a positive integers. That's why yo...

Why am i getting 'Array indices must be positive integers or logical values" when trying to plot this function?

Remove the x1, otherwise it becomes the index of the varaibles f1,f2 & f3 where index must be a positive integers. That's why yo...

5 meses ago | 0

| accepted

Answered

Calculating mean values of a 3D matrix for every rows

Try this: mean(yourmatrix,[2 3]);

Calculating mean values of a 3D matrix for every rows

Try this: mean(yourmatrix,[2 3]);

5 meses ago | 0

| accepted

Answered

Calculate mean value between 2 years

Not sure what is the format of your data. Use function isbetween and below shows an example that you can implement it into your ...

Calculate mean value between 2 years

Not sure what is the format of your data. Use function isbetween and below shows an example that you can implement it into your ...

5 meses ago | 1

| accepted

Answered

How to insert a column of zero into a 3D matrix?

Try this C=cat(2,A,repmat(B,1,1,size(A,3)));

How to insert a column of zero into a 3D matrix?

Try this C=cat(2,A,repmat(B,1,1,size(A,3)));

5 meses ago | 0

| accepted

Answered

Why do I keep getting this error with my for loop?

Remove the for loops, just use y_e1=coeffs(1)*exp(coeffs(2)*-ky_e1); y_e2= coeffs(1)*exp(coeffs(2)*ky_e2); y_e = [y_e1(:,1), ...

Why do I keep getting this error with my for loop?

Remove the for loops, just use y_e1=coeffs(1)*exp(coeffs(2)*-ky_e1); y_e2= coeffs(1)*exp(coeffs(2)*ky_e2); y_e = [y_e1(:,1), ...

5 meses ago | 0

| accepted

Answered

How do you vertically concatenate the rows of a cell array consisting of vectors of numbers?

Tru the following: cellfun(@(x) cell2mat(x),num2cell(a,1),'uni',0)

How do you vertically concatenate the rows of a cell array consisting of vectors of numbers?

Tru the following: cellfun(@(x) cell2mat(x),num2cell(a,1),'uni',0)

5 meses ago | 0

Answered

Why doesn't my figure(2) display anything?

Variable x has 8 numbers while variable a has 9 numbers. However, Variable y and b are calculated based on the value of variabl...

Why doesn't my figure(2) display anything?

Variable x has 8 numbers while variable a has 9 numbers. However, Variable y and b are calculated based on the value of variabl...

5 meses ago | 1

Answered

streak in a character array

Sorry that I overlooked the question in my previous answer, here is the updated one: cArr = 'aaaaBBc'; pos = find(diff([0,diff...

streak in a character array

Sorry that I overlooked the question in my previous answer, here is the updated one: cArr = 'aaaaBBc'; pos = find(diff([0,diff...

5 meses ago | 0

| accepted

Answered

How can DropDown Items dynamically obtain the name of different sheets in Excel instead of manually entering items?

When you import the file, get the sheet names and put them as the 'Items' of the uidropdown. sheetName = sheetnames(fullfile(pa...

How can DropDown Items dynamically obtain the name of different sheets in Excel instead of manually entering items?

When you import the file, get the sheet names and put them as the 'Items' of the uidropdown. sheetName = sheetnames(fullfile(pa...

5 meses ago | 0

| accepted

Answered

how to select an interval of certain hours each day within a larger timetable using timerange

Do you accept not using function timerange as follows? T = readtable('date.txt') T.Var1(hour(T.Var1)<9 | hour(T.Var1)>=17 & ~(...

how to select an interval of certain hours each day within a larger timetable using timerange

Do you accept not using function timerange as follows? T = readtable('date.txt') T.Var1(hour(T.Var1)<9 | hour(T.Var1)>=17 & ~(...

5 meses ago | 0

Answered

plot graph based on given values

May be this: sheets = sheetnames('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx'); ...

plot graph based on given values

May be this: sheets = sheetnames('https://www.mathworks.com/matlabcentral/answers/uploaded_files/941694/my_excel_file.xlsx'); ...

5 meses ago | 1

Answered

How to get mean / averaged values among of duplicated data array?

Use function groupsummary opts = detectImportOptions('demo.txt'); opts.VariableNames = {'Time','Data'}; T = readtable('demo.t...

How to get mean / averaged values among of duplicated data array?

Use function groupsummary opts = detectImportOptions('demo.txt'); opts.VariableNames = {'Time','Data'}; T = readtable('demo.t...

5 meses ago | 0

| accepted

Answered

getframe(), rectangle specified in normalized coordinates instead of pixel coordinates

Try the following workaround f = figure; f.Units = 'normalize'; f.Position = [0.25 0.25 0.5 0.5]; % Location of...

getframe(), rectangle specified in normalized coordinates instead of pixel coordinates

Try the following workaround f = figure; f.Units = 'normalize'; f.Position = [0.25 0.25 0.5 0.5]; % Location of...

5 meses ago | 0