Answered

selecting values between vectors and plot the values

isA=(Ax>Bx); ABx=Bx; ABx(isA)=Ax(isA); plot(ABx,max(Ay,By))

selecting values between vectors and plot the values

isA=(Ax>Bx); ABx=Bx; ABx(isA)=Ax(isA); plot(ABx,max(Ay,By))

16 hours ago | 0

Answered

FindPeaks() of a 1024 x 116 Matrix

findpeaks only works on vector input; just use a loop and pass each column of your array in turn. There's a fair amount of back...

FindPeaks() of a 1024 x 116 Matrix

findpeaks only works on vector input; just use a loop and pass each column of your array in turn. There's a fair amount of back...

16 hours ago | 0

Answered

How to separate weekends from weekdays from an Excel file in MATLAB?

Well, ya' gotsa' start somewhere! We all were newbies once...give it a shot and see how far you get on your own first... Impor...

How to separate weekends from weekdays from an Excel file in MATLAB?

Well, ya' gotsa' start somewhere! We all were newbies once...give it a shot and see how far you get on your own first... Impor...

19 hours ago | 0

| accepted

Answered

extract or split data from one column in table into several columns

>> s='250ms,500ms / 95, 101, 106, 107 / Avg: 11_right / | bl | _HLG_MLD | (9) vs. Avg: 11_right | bl | _CG | _LOW (8) / FCL';...

extract or split data from one column in table into several columns

>> s='250ms,500ms / 95, 101, 106, 107 / Avg: 11_right / | bl | _HLG_MLD | (9) vs. Avg: 11_right | bl | _CG | _LOW (8) / FCL';...

21 hours ago | 0

Answered

Delete data in one table, based upon another table

It would be easier to write working code if we knew the actual format of the variables -- is it really a MATLAB table object or ...

Delete data in one table, based upon another table

It would be easier to write working code if we knew the actual format of the variables -- is it really a MATLAB table object or ...

23 hours ago | 0

| accepted

Answered

How can I duplicate the array data into a fixed number?

No, you don't have to have the same number of points in both lines to plot them on the same axes. Use plot(x1,y1,x2,y2) or p...

How can I duplicate the array data into a fixed number?

No, you don't have to have the same number of points in both lines to plot them on the same axes. Use plot(x1,y1,x2,y2) or p...

1 day ago | 0

Answered

if any command to check table values

We don't have the data and can't see the actual result in context -- although the code snippet posted isn't formatted well, that...

if any command to check table values

We don't have the data and can't see the actual result in context -- although the code snippet posted isn't formatted well, that...

2 days ago | 0

Answered

extract numbers form a column

v=sprintf('%d',double([nan;Q(:,1);nan].'==0)); iStrt=strfind(v,'01').'; iEnd=[strfind(v,'10')-1].'; grpsums=arrayfun(@(i1,i2)...

extract numbers form a column

v=sprintf('%d',double([nan;Q(:,1);nan].'==0)); iStrt=strfind(v,'01').'; iEnd=[strfind(v,'10')-1].'; grpsums=arrayfun(@(i1,i2)...

2 days ago | 1

| accepted

Answered

Conditional average (need help with speed)

Grouping variables and rowfun to the rescue... tMeans=rowfun(@(x),mean(x,'omitnan'),mytable,'InputVariables','T','GroupingVaria...

Conditional average (need help with speed)

Grouping variables and rowfun to the rescue... tMeans=rowfun(@(x),mean(x,'omitnan'),mytable,'InputVariables','T','GroupingVaria...

3 days ago | 0

| accepted

Answered

monts in year sequence, string, matrix

Add the date to a timetable and retime with aggregation-- tt=timetable(datetime(yr,1,1:365).',data); % make timetable of d...

monts in year sequence, string, matrix

Add the date to a timetable and retime with aggregation-- tt=timetable(datetime(yr,1,1:365).',data); % make timetable of d...

3 days ago | 1

Answered

How do I changethe label in a compass graph

Well, the above code commented out pax=gca; so the handle to the axes is either undefined or refers to a probably no longer ex...

How do I changethe label in a compass graph

Well, the above code commented out pax=gca; so the handle to the axes is either undefined or refers to a probably no longer ex...

3 days ago | 0

Answered

What kind of multiplication is going on here?

The degenerate case of a 1x1 matrix IS a scalar and so '*' reverts to scalar operation. It would be simply too inconvenient i...

What kind of multiplication is going on here?

The degenerate case of a 1x1 matrix IS a scalar and so '*' reverts to scalar operation. It would be simply too inconvenient i...

3 days ago | 1

| accepted

Answered

Loop for randomisation assignment in table columns

From above modifications of IA's original using the idea of a lookup table instead of loop... % set path to where the session 1...

Loop for randomisation assignment in table columns

From above modifications of IA's original using the idea of a lookup table instead of loop... % set path to where the session 1...

3 days ago | 1

| accepted

Answered

Calculating discharge over multiple years

Use a table or timetable and rowfun with grouping variables...a couple lines of code and an anonymous function will do it. Fo...

Calculating discharge over multiple years

Use a table or timetable and rowfun with grouping variables...a couple lines of code and an anonymous function will do it. Fo...

3 days ago | 0

| accepted

Answered

Drop a column from a matrix if one number in that column is less than 30

VAL=30; % don't bury "magic numbers" in code; use variables bigMatrix=bigMatrix(:,all(b...

Drop a column from a matrix if one number in that column is less than 30

VAL=30; % don't bury "magic numbers" in code; use variables bigMatrix=bigMatrix(:,all(b...

3 days ago | 0

| accepted

Answered

Loop for randomisation assignment in table columns

% prepare lookup table first... ROWS=cellstr(char('WE', 'BC', 'CCC', 'LB', 'RO', 'NN')).'; ROWS=categorical([ROWS;ROWS([4 5 1 ...

Loop for randomisation assignment in table columns

% prepare lookup table first... ROWS=cellstr(char('WE', 'BC', 'CCC', 'LB', 'RO', 'NN')).'; ROWS=categorical([ROWS;ROWS([4 5 1 ...

4 days ago | 0

Answered

How do I present an audio signal in a time domain plot using MATLAB, such that the y-axis is in decibel (dB) instead of of a linear scale?

See the attached link https://www.dsprelated.com/freebooks/mdft/Decibels.html In particular, note that "Signal intensity, power...

How do I present an audio signal in a time domain plot using MATLAB, such that the y-axis is in decibel (dB) instead of of a linear scale?

See the attached link https://www.dsprelated.com/freebooks/mdft/Decibels.html In particular, note that "Signal intensity, power...

4 days ago | 0

| accepted

Answered

extract elements from signal

Don't create new variables, just x=reshape(x,1000,[]).'; and reference the column of interest. If you create new variables, ...

extract elements from signal

Don't create new variables, just x=reshape(x,1000,[]).'; and reference the column of interest. If you create new variables, ...

5 days ago | 2

| accepted

Answered

export an array to a text file

As documentation for csvwrite says, it is able to write numeric data arrays only; you're trrying to include header data inside t...

export an array to a text file

As documentation for csvwrite says, it is able to write numeric data arrays only; you're trrying to include header data inside t...

5 days ago | 0

Answered

error in figure in matlab

It is, only you have so many points they're all on top of each other instead of being able to distinguish individual points. Yo...

error in figure in matlab

It is, only you have so many points they're all on top of each other instead of being able to distinguish individual points. Yo...

6 days ago | 1

Answered

Smart import of random files

"When the instrument creates its output, this is in .dat." AHA! So you created the problem with the spreadsheet yourself, not ...

Smart import of random files

"When the instrument creates its output, this is in .dat." AHA! So you created the problem with the spreadsheet yourself, not ...

6 days ago | 0

| accepted

Answered

Smart import of random files

c=readcell('Input_type_1.xlsx'); % read as cellstr array c=c(~cellfun(@(c)all(ismissing(c)),c,'Unifo...

Smart import of random files

c=readcell('Input_type_1.xlsx'); % read as cellstr array c=c(~cellfun(@(c)all(ismissing(c)),c,'Unifo...

6 days ago | 0

Answered

Smart import of random files

Save the file as a .csv instead of .xlsx. May have to coerce Excel to not double-quote the strings; I presume there's a way but...

Smart import of random files

Save the file as a .csv instead of .xlsx. May have to coerce Excel to not double-quote the strings; I presume there's a way but...

7 days ago | 0

Answered

Location of plot for subplot(2,2,3)

The logic is sound but as Steven L points out, it would break existing code going back to the beginning of time so TMW will neve...

Location of plot for subplot(2,2,3)

The logic is sound but as Steven L points out, it would break existing code going back to the beginning of time so TMW will neve...

7 days ago | 0

Answered

Describe to plots in one line in legend

Found a few minutes -- Actually works better than I had expected... hL=plot(abs(randn(10,4))); set(hL(1:2),{'color'},{'r'}) s...

Describe to plots in one line in legend

Found a few minutes -- Actually works better than I had expected... hL=plot(abs(randn(10,4))); set(hL(1:2),{'color'},{'r'}) s...

8 days ago | 2

Answered

How to plot values in lower and higher x-values with putting a break in the plot for middle x-values?

MATLAB doesn't know about broken axes, unfortunately. You might explore the FEX and see if there are any user submissions ther...

How to plot values in lower and higher x-values with putting a break in the plot for middle x-values?

MATLAB doesn't know about broken axes, unfortunately. You might explore the FEX and see if there are any user submissions ther...

9 days ago | 0

Answered

Performing formulas on .mat files in MATLAB

You don't tell us much to go on, but the averaging is simple -- you just have to have a way to find which column(s) are in the f...

Performing formulas on .mat files in MATLAB

You don't tell us much to go on, but the averaging is simple -- you just have to have a way to find which column(s) are in the f...

11 days ago | 0

Answered

Create a new row in a loop

f1=10; f2=50; coherence=cell(numel(f1:f2),numel(three_d_trials)); j=0; for freq=f1:f2 j=j+1; for coherence_index = 1:le...

Create a new row in a loop

f1=10; f2=50; coherence=cell(numel(f1:f2),numel(three_d_trials)); j=0; for freq=f1:f2 j=j+1; for coherence_index = 1:le...

12 days ago | 1

| accepted

Answered

Plot a normal figure and animatedline together onthe same figure

... % I want also to plot the following in the same figure % I want the graph to apear in full in the begining not as an anima...

Plot a normal figure and animatedline together onthe same figure

... % I want also to plot the following in the same figure % I want the graph to apear in full in the begining not as an anima...

13 days ago | 0

| accepted

Answered

plotting live data from a sensor

You are plotting only one point at a time and without having executed a hold on instruction, each call to plot creates a new lin...

plotting live data from a sensor

You are plotting only one point at a time and without having executed a hold on instruction, each call to plot creates a new lin...

13 days ago | 0

| accepted