Answered
3-d plot generated from simulations
n = 1000; iMax = 50; jMax = 50; myArray = zeros(iMax, jMax); for iIdx = 1:iMax for jIdx = 1:jMax myArray(iIdx,j...

4 years ago | 0

| accepted

Answered
text box for 'xline' function?
There are a few ways to do this. With annotation, it's easy to combine an arrow with a text box. The downside is you have to u...

4 years ago | 0

| accepted

Answered
How to perform a calculation only when a input value is positive
It is not clear what you mean by "input value", but assuming you do know, then... for chi_e > 0.0 if input_value > 0 ...

4 years ago | 0

Answered
How to change line width of matlab legend without changing the other legend options?
I don't see the problem you note, re a change in the number of columns in the legend. The error occurs because you are trying t...

4 years ago | 2

Answered
Excel sheet mean of the row and plot the graph
T = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/635705/Kendri.xlsx'); x = T{:,1}; % x-axis cond...

4 years ago | 1

| accepted

Answered
how to plot string data on x axes
% test data cases = randi(100, 1, 5); % number of covid cases names = { 'abc' 'def' 'ghi' 'jkl' 'mno' }; % country names % ...

4 years ago | 0

| accepted

Answered
definitions in a script must appear at the end of the file.
Functions defined in a script (such as imeme2022 in your script) must be positioned at the end of the script. The error message...

4 years ago | 0

Answered
Make several tables from one table
Try this... % table containing your data T = readtable('yourdata.xlxs'); % vectors of indices for ON/OFF rows idxFirst = f...

4 years ago | 1

| accepted

Answered
i need to make space between two bar plot in x axis
With the labels you are using, a multi-line tick label might look better: n = [81.2858,82.6818,82.0401,82.0560]; bar(diag(n), ...

4 years ago | 0

| accepted

Answered
Matlab bouncing ball in box
There are alternatives to animatedline. You can create a ball using rectangle with the curvature property set to 1. But, given...

4 years ago | 0

Answered
Separating repeated values in an excel column.
If the number of readings varies, as you say, from 8 to 12, then... T = readtable('yourdata.xlsx'); names = unique(T{:,1}); j...

4 years ago | 0

Answered
Separating repeated values in an excel column.
When you say "plot all the 12 readings", I assume there are exactly 12 readings per name. In this case... T = readtable('yourd...

4 years ago | 0

Answered
Creating new table from another table
You have several problems in your code. The assumtion in your question is that you want to create a new table (newtable) contai...

4 years ago | 1

| accepted

Answered
How do I make a rectangle that is in maximized state in MATLAB ?
The rectangle function does not draw a rectangle directly on your system's display. It creates a rectangle in the current axes ...

4 years ago | 0

Answered
How to fit an exponential curve with known error bars
The plot looks curved to me. The error bars in your chart appear as horizontal lines because they are really small. Here's a t...

4 years ago | 0

Answered
Writing a string that fills to the left
You need to include a field width in the format specifier. An example for integers: fprintf(fid, 'Item one: %8d %8d %8d', A, ...

4 years ago | 1

| accepted

Answered
How can I measure the area covered by a Bar Chart Plot?
Your question is a bit of a moving target. The question title refers to a bar plot. The question text refers to a histogram wi...

4 years ago | 0

| accepted

Answered
How to use "while loop" in this case?
You've got a for-loop inside a while-loop. This is likely unnescessary. Here's approximately what you need... sampleSize = 18...

4 years ago | 0

Answered
t test on each grid point between two 3D matrices (3rd dimension)
You are using the wrong form of ttest2. If you want to get the stats structure, change [h,p,stats] = ttest2(group1,group2, 'di...

4 years ago | 0

| accepted

Answered
How to re-scale the colorbar without affecting the graph?
Just set the Limits property of the colorbar. Here's an example for bar charts ... tiledlayout('flow'); nexttile; x = 1:5;...

4 years ago | 1

| accepted

Answered
How to get origin vector form indexd matrix
idx2 = [1 3 4 2 5 6]; C = B(idx2)

4 years ago | 0

Answered
Sawtooth diagram for automotive use
Here's some code to create a sawtooth pattern: samples = 100; % per cycle cycles = 5; peak = 15; y = linspace(peak,0,samp...

4 years ago | 0

Answered
Norm and mean of a time series
The first error is in the 3rd line. norm is a built-in MATLAB function and requires at least one input argument. The second "e...

4 years ago | 1

| accepted

Answered
How to remove rows in Table
You want to read 10 columns of data in rows 650 to 1200. There is no need to read the entire file. Try this... inFile = 'your...

4 years ago | 1

| accepted

Answered
How to add even numbers in matlab
x = 100; % the highest number for the sum operation sum(2:2:x)

4 years ago | 0

| accepted

Answered
How do i use least square method to fit a nonlinear curve to data set below ?
This solution uses polyfit and a log transformation, converting the power-law into a linear equation. There might by an easier ...

5 years ago | 0

| accepted

Answered
How do i use least square method to fit a nonlinear curve to data set below ?
Which non-linear curve? Here are a few options for you, for polynomials with orders 1 through 6: p = [40 50 60 80 100]; r = [...

5 years ago | 0

Answered
Counting years from a date time variable
This seems to achieve what you are after... % test data d = datetime(randi([1962 2020],1,50), randi(12,1,50), randi(28,1,50));...

5 years ago | 0

| accepted

Answered
Brace indexing is not supported for variables of this type.
It's hard to tell because you haven't stated what Csurf contains. Yes, it's a cell matrix, but a cell matrix containing what? ...

5 years ago | 1

| accepted

Answered
How to show values on horizontal stacked bar graph bar in Matlab app designer?
This question is answer here

5 years ago | 0

| accepted

Load more