Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

Respondida
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)*(...

más de 4 años hace | 0

| aceptada

Respondida
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_...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 1

Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

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

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

Respondida
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 ...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 2

| aceptada

Respondida
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))

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 1

| aceptada

Respondida
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_...

más de 4 años hace | 1

| aceptada

Respondida
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 ...

más de 4 años hace | 2

Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 1

| aceptada

Cargar más