Answered
CONTROL ERRORBAR IN MATLAB
% some data to plot x = 1:100; y = sin(x); err = randn(size(y)); % 1) busy plot with too many errorbars ax1 = subplot(2,1...

4 years ago | 0

| accepted

Answered
I want to label each bar within a cluster in a clustered bar graph, and I want each cluster to be a different color
y=[0.68542594 0.5996976 0.52299593 0.92475461;0.1953691 1.56721222 0.6094734 0.2874436;1.4807764 0.0617133 1.2229648 0.0401016;0...

4 years ago | 0

| accepted

Answered
How to create a list/array of output from Simulation
"I want to somehow count the number of times I get the value V = 100" OK: count = 0; nTrials = 5; rng(11); % * for sim=1:nT...

4 years ago | 0

Answered
Adding each row of a matrix to another matrix
A1 =rand(4, 2); A2 =rand(2, 2); % the original method A12=zeros(size(A1,1)*size(A2,1),size(A1,2)); startind=1+size(A1,1)*(...

4 years ago | 0

| accepted

Answered
HowTo make slice grid transparent?
x_3 = -15:0.1:14.9; y_3 = -14:0.1:13.9; z_3 = -2:0.1:38; V = rand([numel(x_3) numel(y_3) numel(z_3)]); s = slice(y_3, x_...

4 years ago | 0

| accepted

Answered
How to make 3 bar subplots have the same scale?
Use the output from subplot to store the axes. Then set the XLim and YLim of the axes. figure ax = zeros(3,1); ax(1) = subplo...

4 years ago | 0

Answered
Fitting Curve with scattered dots
The problem is that zaxe and dxPixel are overwritten on each iteration of the for loop, so after the loop finishes, they have th...

4 years ago | 0

Answered
I am trying to imput tanh^4(0.5x) e^−sin2(x) into matlab but I am not sure how.
Here's how to make a function handle out of f(x), assuming sin2(x) is (sin(x))^2, which you could use for whatever: f = @(x)tan...

4 years ago | 0

Answered
Putting alpha in a string
Use double-backslash to escape the backslash in sprintf, so that what's returned from sprintf contains '\alpha'. Not clear wher...

4 years ago | 1

Answered
questdlg issue about size of the font
Using tex interpreter is going to be much easier than any other way: answer = questdlg('\fontsize{20}MOSTRARE RISULTATI CALCOLA...

4 years ago | 0

Answered
Creating a mat file with binary mask
row = 256; col = 256; mask = zeros(row, col); % 32 vertical lines in the middle (or one vertical line 32 columns wide) m...

4 years ago | 0

| accepted

Answered
Count number of words per row in a string
I won't claim that this is the best way to do it, or that it'll work for anything you want to consider a "word" in your string a...

4 years ago | 0

Answered
Using a For Loop to plot a sample range for a difference equation
Given in the question: % input signal % x(n) = cos(pi/60*n), n = 0,1,2,...,999 % % output signal % from difference equatio...

4 years ago | 0

Answered
y axis scaling plot
This File Exchange submission may be of use: https://www.mathworks.com/matlabcentral/fileexchange/7210-ternary-plots

4 years ago | 0

Answered
Plot Semilog/loglog data missing in plot
"I want plot to be in loglog from 20hz to 30Mhz" That's easy enough to acheive by setting the x-limits of the log-log plot: f...

4 years ago | 0

Answered
how to merge multiple csv files to create a timetable for synchronization?
This will create timetables from all the .csv files in a specified directory and pass them all to the synchronize function. (If ...

4 years ago | 0

| accepted

Answered
Surf plot is black
The reason you get a surface that's all black is that the grid is too fine, so all you see are the black lines between grid cell...

4 years ago | 2

| accepted

Answered
How to identify the position in which a value is NaN
You can use the isnan function: x = [1 NaN 3 4 5 NaN 7 8 9 10]; find(isnan(x))

4 years ago | 0

| accepted

Answered
How to remove values from a data set to make it a specific length?
If that's what you want to do xdata = [ 1 2 3 4 5 6 7 8 ]; ydata = [ 1 2 3 4 5 6 ]; % n is the minimum of {number of elemen...

4 years ago | 0

| accepted

Answered
Is there a way to check each index of a matrix against each index of another smaller matrix?
% a matrix: A = magic(5) % a smaller matrix: B = [1 15 6; 20 12 21; 25 2 9] % index(es) of row(s) of A that have no elements...

4 years ago | 0

| accepted

Answered
Setting elements of an array to be zero based on the values of a vector
A = [1 0 0; 0 1 1; 1 1 0]; B = [1 3 5]; % set all elements in those rows of A, whose index is in B, to zero A(B(B <= size(A...

4 years ago | 0

| accepted

Answered
Reading from Excel File and
data = readtable('SpentinUSDollar.xlsx'); % remove extra columns from table: data(:,4:end) = []; % get the set of relevant ...

4 years ago | 1

| accepted

Answered
I would like to randomly mixed rows from Excel through MATLAB
data = xlsread('excel_data.xlsx'); % randomly permute the rows of data: data = data(randperm(size(data,1)),:); handles.v_...

4 years ago | 1

| accepted

Answered
How to loop multi-line with data text?
You can read the file in one fell swoop, then break the contents into individual lines, and retrieve the dates/times from lines ...

4 years ago | 2

Answered
Undefined operator '-' for input arguments of type 'matlab.graphics.chart.primitive.Contour'.
This error means that you can't subtract something from a contour object (and you can't subtract a contour object from something...

4 years ago | 0

Answered
I get an errorr in my code for a scatter graph but i can't figure out whats causing it
Use ellipses (three periods, " ... ") to continue an expression to the next line: gscatter(train_data(:,1), train_data(:, 2...

4 years ago | 0

| accepted

Answered
Problem with creating .dat file
You check if the variable theSimfile exists, and if it doesn't, you create a variable called simfile. Then you use theSimfile (w...

4 years ago | 0

Answered
Wind rose as a scatter plot --Function definitions are not permitted in this context
You get this error: Error using ScatterWindRose (line 31) Not enough input arguments if you run ScatterWindRose by clicking t...

4 years ago | 0

| accepted

Answered
How to change the axis limits of plotted graph in .fig format
% make some plot with two y-axes yyaxis right plot(2:20) yyaxis left plot(1:10); % save the figure to file saveas(gcf(),'m...

4 years ago | 0

| accepted

Answered
logical index plot specific columns
%% clc clear %% % read table data = readtable('SpentinUSDollar.xlsx','NumHeaderLines',1) % use curly braces { } to access ...

4 years ago | 1

| accepted

Load more