Respondida
Replacing some elements in the row with maximum value along the row
There might be a simpler solution, but this seems to work: A=[1 2 3 0 0; 7 4 5 1 0; 2 4 6 0 3] for i=1:size(A,1) A(i,...

más de 2 años hace | 1

Respondida
How to prevent Matlab from rounding numbers when it saves them to a variable?
The rounding you are observing occurs through the num2str function. You can control this using one of the other variants of num...

más de 2 años hace | 0

| aceptada

Respondida
plotting 2 time series with errorbars along double y axis
I think this is more-or-less what you are after, based on the figure posted: % test data x = 1:10; A = [2 8 6 11 18 19 16 22 ...

más de 2 años hace | 0

Respondida
How to plot x and y error bars together with the data points?
Something like this seems to work: % test data x = randi([2 8],1,5); y = randi([2 8],1,5); error_x = rand(1,5); error_y = r...

más de 2 años hace | 0

| aceptada

Respondida
The loop is continuously running
Your loop is fine, but is inefficient and takes a long time to execute. Instead of the loop, try this: [Lia, Locb] = ismember(T...

más de 2 años hace | 0

| aceptada

Respondida
How to grow a vector in a loop?
One approach is to declare coeff as an empty array before the first for-statement: coeff = []; then add new values to the end ...

más de 2 años hace | 0

Respondida
How to create randi function between 0-500
Just use the imin-imax version of randi. For example n = randi([0, 500], 50, 1); generates a column vector of random integers...

más de 2 años hace | 2

Pregunta


Using F1 for help, gives help for wrong function
Consider this code snippet: plot(x, y1); % 2D line plot hold on; plot(x, y2); % 2D line plot plot(p); % polyshape plo...

más de 2 años hace | 1 respuesta | 0

1

respuesta

Respondida
Filling in missing data with previous data to perform calculations
Since you define bad or erroneous data as values equal to 500 or values less than 60, how about this. Replace the erroneous val...

más de 2 años hace | 1

| aceptada

Respondida
p value for two sets having variable x and y
Since for each system, y is the measured response for x, you can reduce the data for that set to x-y. Also, since the systems u...

más de 2 años hace | 0

Pregunta


ranksum function is purportedly the same as the Mann-Whitney U test, but the results differ. Is there a reason why?
I've written a script to implement the Mann-Whitney U non-parametric test. As a guide, I used a data set (attached) and example...

más de 2 años hace | 0 respuestas | 0

0

respuestas

Respondida
How do you print the F-stat in a multcompare test?
@Darla Bonagura There is no F-statistic for post hoc pairwise comparisons tests such as Bonferonni, Scheffe, and so on. There i...

más de 2 años hace | 0

Respondida
Replacing Empty Cells by NaN
You can use fillmissing and specify the fill value for each column. Obviously, the fill values depend on the data type in the c...

más de 2 años hace | 0

| aceptada

Respondida
Remove dimension from high dimensional array
Try this... M = rand(10, 8, 10, 8, 6, 7, 8, 9); whos M(:,:,:,:,2:end,:,:,:) = []; N = squeeze(M); whos

más de 2 años hace | 1

| aceptada

Respondida
Repeat a cumulative sum in a matrix
Here's a way to do this without a loop: % test data (monthly returns for many investments for 252 months) M = rand(2784,252); ...

más de 2 años hace | 1

| aceptada

Respondida
How can I change the interval on the y-axis?
Here's some example code on how to control the "ticks": x = 1:5; y = randi(100, 1, 5); plot(x,y); set(gca, 'ylim', [0 100]...

más de 2 años hace | 2

| aceptada

Respondida
How to put the marker data over the curve fitting line?
You posted your reply comment as an answer. Oops. But, I see your point. And I'll try to explain here as an answer (although ...

más de 2 años hace | 0

Respondida
How can I transform these data into seasonal data?
Note: Code in comment moved here... load('DATI_MAR_mensili'); % NOTE: loads a table with 'Year' and 'Month' columns % add...

más de 2 años hace | 0

| aceptada

Respondida
How to Calculate Area Between a Curve and Two Lines?
At the end of your code, add... x = D_Curve_PD_KPe; y = D_Curve_PD_KDe; cropLogical = x > 0; x = x(cropLogical); y = y(cr...

más de 2 años hace | 0

| aceptada

Respondida
How can I store the value of variable 'dist_5thwheel_to_second_axle_sem2_itr' in array/vector format with every for loop iteration such that previous value stays as well? ?
You've got a bug in the setup of your loops. For the inner loop, change for i2 = 1:counter1 to for i2 = 1:counter2...

más de 2 años hace | 0

| aceptada

Respondida
How to create column headers?
Something like this will work. I'm only showing the inner for-loop. fprintf('%6s%6s\n\n', 'x', 'y'); for n=1:length...

más de 2 años hace | 1

| aceptada

Respondida
how to find area under curve for every 10msec?
Here's solution that shows the slope (derivative) and area (integral) sample-to-sample in the signal. The sample period is 10 m...

más de 2 años hace | 0

| aceptada

Respondida
How to have a just specific part of a plot?
Follow the plot command with... axis([0 400 0 120]); axis off; set(gcf,'color','w'); Output:

más de 2 años hace | 0

| aceptada

Respondida
Add legend to plot colored by colormap function
One approach is to do three scatters, one for each value in the 3rd column in your data. Here's the general idea using a modifi...

más de 2 años hace | 0

Respondida
How can I transform these data into seasonal data?
@Pul. Here's a solution that allows you to get summary statistics by season: load('testdata.mat'); % loads giulia_TT timetable...

más de 2 años hace | 0

| aceptada

Respondida
How can I subtract the times without considering the date in question?
Here's one way to do this: % test data (one month in 30-min increments) dt = datetime(2021,4,1):minutes(30):datetime(2021,5,1)...

más de 2 años hace | 0

Respondida
How to plot multiple lines with gray color
Here's one way to do this: p=rand(12,5); figure (2) plot(p, 'color', [.5 .5 .5], 'linewidth', 1.5); % gray lines % put tex...

más de 2 años hace | 1

| aceptada

Respondida
Convert final grade letter into categorical array.
% test data containing student letter grades C = { 'A' 'C' 'D' 'A' 'D' 'B' 'B' 'C' 'A' }; % define C to be categorical C = ...

más de 2 años hace | 0

Respondida
how can a make a loop for a double value in Matlab?
It's not clear what 19 variables you have in the table T1, but I suspect your error will disappear via... for i = 1:length(ID) ...

más de 2 años hace | 0

Respondida
How to detect negative number in Switch and case statement
Look carefully. Because you are switching on error, your first case expression reduces to error == (error < 0 && Uz > 0) ...

más de 2 años hace | 0

| aceptada

Cargar más