Answered

How do I make a vector containing 30 cells that range from -5 to 45?

randi([-5 45],1,30)

How do I make a vector containing 30 cells that range from -5 to 45?

randi([-5 45],1,30)

12 months ago | 0

| accepted

Answered

How to remove rows with zeros in selected columns?

There is probably a simpler solution, but this will work... a = [ 1 0 5 0 6 2 0 0 0 0 3 3 5 9 12 4 0 0 0 0...

How to remove rows with zeros in selected columns?

There is probably a simpler solution, but this will work... a = [ 1 0 5 0 6 2 0 0 0 0 3 3 5 9 12 4 0 0 0 0...

12 months ago | 0

| accepted

Answered

Easiest way to create a line from 2 XY coordinates

MATLAB's hypot function is probably your best bet: M = [0 125.1673584 13.18046188 194.4534607 176.9597931; 1 126.4874725 ...

Easiest way to create a line from 2 XY coordinates

MATLAB's hypot function is probably your best bet: M = [0 125.1673584 13.18046188 194.4534607 176.9597931; 1 126.4874725 ...

12 months ago | 0

| accepted

Answered

Creating subset of table

Since column 1 contains numbers in cells, something like this is needed: T = array2table([{1, -2, 3}' {'a' 'b' 'c'}']) % test d...

Creating subset of table

Since column 1 contains numbers in cells, something like this is needed: T = array2table([{1, -2, 3}' {'a' 'b' 'c'}']) % test d...

12 months ago | 0

Answered

How to preform Anova + Tukey for within-subject design

I believe the issue is you've incorrectly specified the variable as the second argument in multcompare. Try tbl = multcompare(...

How to preform Anova + Tukey for within-subject design

I believe the issue is you've incorrectly specified the variable as the second argument in multcompare. Try tbl = multcompare(...

12 months ago | 0

Answered

Repeated measure ANOVA in MATLAB

What you have is a 2 x 4 within-subjects design. The independent variables are "Method" (2 levels) and "Case" (4 levels). You d...

Repeated measure ANOVA in MATLAB

What you have is a 2 x 4 within-subjects design. The independent variables are "Method" (2 levels) and "Case" (4 levels). You d...

1 year ago | 1

| accepted

Answered

Remove arrays from a cell based on certain conditions

If x is an array of numeric data, then if x(1) > x(end) clear x; end will delete the array x if the "first value is grea...

Remove arrays from a cell based on certain conditions

If x is an array of numeric data, then if x(1) > x(end) clear x; end will delete the array x if the "first value is grea...

1 year ago | 0

Answered

Turning categories into double

Let's assume T.Var1 is a categorical column in your table, as you describe it. To convert this to a column of double values, re...

Turning categories into double

Let's assume T.Var1 is a categorical column in your table, as you describe it. To convert this to a column of double values, re...

1 year ago | 0

| accepted

Answered

Is there a way to measure interletter spacing for Fixed Width font in MATLAB?

For text fonts, 1 pt = 1/72 inches. So, if you set the font size of the text to, say, 36 pt., the character height will be 1/2 ...

Is there a way to measure interletter spacing for Fixed Width font in MATLAB?

For text fonts, 1 pt = 1/72 inches. So, if you set the font size of the text to, say, 36 pt., the character height will be 1/2 ...

1 year ago | 0

Answered

prepare a table for fitrm and manova

Using the example in the documentation for the manova function, here's a MANOVA for your data (attached): load atb; Meas = tab...

prepare a table for fitrm and manova

Using the example in the documentation for the manova function, here's a MANOVA for your data (attached): load atb; Meas = tab...

1 year ago | 0

| accepted

Answered

Producing the same-sized box plots for subfigures

One approach is just to use a dummy y-axis label for the plots in the 2nd and 3rd columns: if mod(i,3)==1 ylabel('Data'); ...

Producing the same-sized box plots for subfigures

One approach is just to use a dummy y-axis label for the plots in the 2nd and 3rd columns: if mod(i,3)==1 ylabel('Data'); ...

1 year ago | 0

| accepted

Answered

Skipping a line no delimiters in an array

From your comment, it seems you are working with an Excel file, as opposed to comma-delimited text file. Given this and your ...

Skipping a line no delimiters in an array

From your comment, it seems you are working with an Excel file, as opposed to comma-delimited text file. Given this and your ...

1 year ago | 0

| accepted

Answered

Plotting time series of Velocity over 48 hours

% test value for Ttide (not given in question) Ttide = 1; figure(1); Vm=5.07; % Calculated on Paper %t=[1:1:48]; % Time ...

Plotting time series of Velocity over 48 hours

% test value for Ttide (not given in question) Ttide = 1; figure(1); Vm=5.07; % Calculated on Paper %t=[1:1:48]; % Time ...

1 year ago | 0

| accepted

Answered

How to find the common dates between two different variables that are not the same size or format?

% load dt and dt2, as per question load test % ignore minutes and seconds dt = dateshift(dt,'start','hour'); dt2 = datesh...

How to find the common dates between two different variables that are not the same size or format?

% load dt and dt2, as per question load test % ignore minutes and seconds dt = dateshift(dt,'start','hour'); dt2 = datesh...

1 year ago | 0

Answered

Array indices must be positive integers or logical values.

You've got a typo in your code. Change the indices 1i to i

Array indices must be positive integers or logical values.

You've got a typo in your code. Change the indices 1i to i

1 year ago | 1

| accepted

Answered

Round all values in table

I think this achieves what you are after: % test data T1 = array2table(rand(5)) % rounded to 2 decimal places T2 = array2tab...

Round all values in table

I think this achieves what you are after: % test data T1 = array2table(rand(5)) % rounded to 2 decimal places T2 = array2tab...

1 year ago | 1

Answered

Generate pure tone sequence in frequence domain

Seems you want to start by specifying your signals in the frequency domain, then convert to the time domain. I think this does ...

Generate pure tone sequence in frequence domain

Seems you want to start by specifying your signals in the frequency domain, then convert to the time domain. I think this does ...

1 year ago | 0

| accepted

Answered

Trying to find a value at a specific point in an array.

Just use H(Tmax) BTW, the value is 28106.

Trying to find a value at a specific point in an array.

Just use H(Tmax) BTW, the value is 28106.

1 year ago | 0

| accepted

Answered

Specify the path of X and Y axis (MATLAB)

After your plot command, add set(gca, 'xlim', [0 1], 'ylim', [0 1]);

Specify the path of X and Y axis (MATLAB)

After your plot command, add set(gca, 'xlim', [0 1], 'ylim', [0 1]);

1 year ago | 0

Answered

Unable to use a value of type string as an index

Inside your loop, change catbl1(catbl1=x)=div*c; to catbl1(catbl1==x)=div*c;

Unable to use a value of type string as an index

Inside your loop, change catbl1(catbl1=x)=div*c; to catbl1(catbl1==x)=div*c;

1 year ago | 2

Answered

Removing quotations from table display

Seems like you just want a more visually appealing presentation for the user. Something like this might work: vNames = {'a' 'a...

Removing quotations from table display

Seems like you just want a more visually appealing presentation for the user. Something like this might work: vNames = {'a' 'a...

1 year ago | 0

| accepted

Answered

from a circle to polygon

I know of no such formula, although no doubt one could be put together. You can think of circle as a polygon with a large (in...

from a circle to polygon

I know of no such formula, although no doubt one could be put together. You can think of circle as a polygon with a large (in...

1 year ago | 0

| accepted

Answered

find the lowest value in a selection of data

[m, idx] = min(T(S1,6)); % minimum value in column 6, as per S1 x = T(idx,5); % value in column 5 at same location/r...

find the lowest value in a selection of data

[m, idx] = min(T(S1,6)); % minimum value in column 6, as per S1 x = T(idx,5); % value in column 5 at same location/r...

1 year ago | 0

| accepted

Answered

Says "error using plot, vectors must be the same length"

Just a simple mistake. Change the 3rd line to xx1=linspace(0,8.*pi,100); Or, for higher resolution, change all the linspace f...

Says "error using plot, vectors must be the same length"

Just a simple mistake. Change the 3rd line to xx1=linspace(0,8.*pi,100); Or, for higher resolution, change all the linspace f...

1 year ago | 1

| accepted

Answered

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

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

1 year ago | 1

Answered

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

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

1 year ago | 0

| accepted

Answered

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

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

1 year ago | 0

Answered

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

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

1 year ago | 0

| accepted

Answered

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

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

1 year ago | 0

| accepted