Answered

Plot segments of an array with NaN using a for loop

Rough outline to accomplish -- ix=find(isnan(A)); ix=ix(2:end); % find the NaN sections, ignore first for i=1:numel(ix)...

Plot segments of an array with NaN using a for loop

Rough outline to accomplish -- ix=find(isnan(A)); ix=ix(2:end); % find the NaN sections, ignore first for i=1:numel(ix)...

environ 8 heures ago | 0

Answered

Convert Text into Date Format

>> datetime('196307','InputFormat','yyyyMM') ans = datetime 01-Jul-1963 >> or >> datetime([floor(196307/100) 196307...

Convert Text into Date Format

>> datetime('196307','InputFormat','yyyyMM') ans = datetime 01-Jul-1963 >> or >> datetime([floor(196307/100) 196307...

1 jour ago | 1

Answered

x-axis difference between two graphs

As suggested above, interp1 works just fine... red=readtable('red.txt');black=readtable('black.txt'); % read data plot(red.Va...

x-axis difference between two graphs

As suggested above, interp1 works just fine... red=readtable('red.txt');black=readtable('black.txt'); % read data plot(red.Va...

1 jour ago | 0

Answered

finding cells with positive values in a cell array with empty cells, cells of positive integers, and cells of nans

>> idx=cellfun(@(c)any(c>0),co_burst); >> whos idx Name Size Bytes Class Attributes idx ...

finding cells with positive values in a cell array with empty cells, cells of positive integers, and cells of nans

>> idx=cellfun(@(c)any(c>0),co_burst); >> whos idx Name Size Bytes Class Attributes idx ...

1 jour ago | 0

| accepted

Answered

Match timestamps from different data sets

See <matlab timetables> for the introduction to using timetables In particular for your particular Q? read the Topic on Resampl...

Match timestamps from different data sets

See <matlab timetables> for the introduction to using timetables In particular for your particular Q? read the Topic on Resampl...

1 jour ago | 0

Answered

How can I read text files and compile a joint XY Position history

Well, it does seem to "just work" -- almost. jsondecode doesn't know about the 2D array bit, but it did decode the JSON info bl...

How can I read text files and compile a joint XY Position history

Well, it does seem to "just work" -- almost. jsondecode doesn't know about the 2D array bit, but it did decode the JSON info bl...

2 jours ago | 0

Answered

While loop in if and for loop

for i = 2:N if Gyr_2(i,3) Output=RBK2(Input); elseif Gyr_2(i,1) || Gyr_2(i,2) || Ori_2(i,1) || Ori_2(i,2) Output...

While loop in if and for loop

for i = 2:N if Gyr_2(i,3) Output=RBK2(Input); elseif Gyr_2(i,1) || Gyr_2(i,2) || Ori_2(i,1) || Ori_2(i,2) Output...

2 jours ago | 0

Answered

How to suppress opening of command window?

Use the -batch option See <matlabwindows> for all startup options (windows, there are other links for other OS)

How to suppress opening of command window?

Use the -batch option See <matlabwindows> for all startup options (windows, there are other links for other OS)

2 jours ago | 0

Answered

creating a coundown alarm everytime a function have been asked

function [] = alarm(varargin) % alarm -- display countdown left % Optional arguments % 'init' -- reset counter persisten...

creating a coundown alarm everytime a function have been asked

function [] = alarm(varargin) % alarm -- display countdown left % Optional arguments % 'init' -- reset counter persisten...

2 jours ago | 0

Answered

How to use Xlswrite command in actxserver and how to avoid script gets hanged due to hworkbook.close command?

". I just need to avoid xlswrite in my command" Indeed. You don't want to be running dueling ActiveX processors at the same ti...

How to use Xlswrite command in actxserver and how to avoid script gets hanged due to hworkbook.close command?

". I just need to avoid xlswrite in my command" Indeed. You don't want to be running dueling ActiveX processors at the same ti...

2 jours ago | 0

Answered

Fill in missing data, unrecorded values, multiple columns

"am somewhat new to matlab and this is all I need help with..." In that case, you're doing well indeed! Congratulations!!! :)...

Fill in missing data, unrecorded values, multiple columns

"am somewhat new to matlab and this is all I need help with..." In that case, you're doing well indeed! Congratulations!!! :)...

2 jours ago | 0

Answered

How to code an equation with a variable that implies to all cell and save in same size of input array (using nested for loop)

data =xlsread('***'); minOverall=min(data,[],'all'); rngOverall=range(data,'all'); data=(data-minOverall)/rngOverall; Given ...

How to code an equation with a variable that implies to all cell and save in same size of input array (using nested for loop)

data =xlsread('***'); minOverall=min(data,[],'all'); rngOverall=range(data,'all'); data=(data-minOverall)/rngOverall; Given ...

2 jours ago | 0

Answered

How to return entire elements of a column of a matrix while that column includes maximum value of among all other elements of matrix

[~,ix]=max(max(A)); % return column of max of 2D array B=A(:,ix); % the resulting column Too bad there's...

How to return entire elements of a column of a matrix while that column includes maximum value of among all other elements of matrix

[~,ix]=max(max(A)); % return column of max of 2D array B=A(:,ix); % the resulting column Too bad there's...

3 jours ago | 0

| accepted

Answered

Change file matlab workspace name as the folder name

" 'POWER.mat' , and the folder name is 'Results2021'" Well, it depends on whether you have already created the .mat file by hav...

Change file matlab workspace name as the folder name

" 'POWER.mat' , and the folder name is 'Results2021'" Well, it depends on whether you have already created the .mat file by hav...

3 jours ago | 1

| accepted

Answered

Three variables (two independent) 3D plotting

M=1; N=2; flg=true; for B=-20:20; X=M+B;l T=[]; for L=-10:10; Y=N+X; r=B+Y+L^2; sca...

Three variables (two independent) 3D plotting

M=1; N=2; flg=true; for B=-20:20; X=M+B;l T=[]; for L=-10:10; Y=N+X; r=B+Y+L^2; sca...

3 jours ago | 0

| accepted

Answered

How can we convert struct file to txt file?

arrayfun(@(s) writematrix([s.S s.F],[s.ID '.txt']),structWheeze)

How can we convert struct file to txt file?

arrayfun(@(s) writematrix([s.S s.F],[s.ID '.txt']),structWheeze)

3 jours ago | 0

| accepted

Answered

How can I link data from separate arrays?

Making harder than needs must be -- Thickness=[19.0;22.0;32.0]; Temp_data=cat(3l [0,-0.05;0.2,-0.13;0.4,0.25;0.6,0.64;0.8,0.56...

How can I link data from separate arrays?

Making harder than needs must be -- Thickness=[19.0;22.0;32.0]; Temp_data=cat(3l [0,-0.05;0.2,-0.13;0.4,0.25;0.6,0.64;0.8,0.56...

4 jours ago | 1

| accepted

Answered

How to find corresponding frequencies after viewing amplitude in descending order?

[DescendAmp,idx] = sort(peak_ft,'descend'); disp([peak_fr(idx) peak_ft])

How to find corresponding frequencies after viewing amplitude in descending order?

[DescendAmp,idx] = sort(peak_ft,'descend'); disp([peak_fr(idx) peak_ft])

4 jours ago | 0

Answered

plot discontinuous x axis

Divide the time vector by T(end) for each trace and then plot versus the normalized time [0 1] instead...

plot discontinuous x axis

Divide the time vector by T(end) for each trace and then plot versus the normalized time [0 1] instead...

4 jours ago | 0

Answered

How to Enclose a Figure Title in a Box?

hT=title('This is a title','EdgeColor','k');

How to Enclose a Figure Title in a Box?

hT=title('This is a title','EdgeColor','k');

4 jours ago | 0

| accepted

Answered

Comparing date/time values in Matlab/ calling out date time values to use in code

Convert to a timetable and all kinds of tools are available; see <Overview Timetables> for all of the above kinds of operations

Comparing date/time values in Matlab/ calling out date time values to use in code

Convert to a timetable and all kinds of tools are available; see <Overview Timetables> for all of the above kinds of operations

6 jours ago | 0

| accepted

Answered

Creating a Histogram of Letter grades converted from number grades

One way that illustrates lookup table approach... GRADES=[0,60,69.9,73.9,76.9,79.9,83.9,86.9,89.9,94.9,95.9,100]; % letter grad...

Creating a Histogram of Letter grades converted from number grades

One way that illustrates lookup table approach... GRADES=[0,60,69.9,73.9,76.9,79.9,83.9,86.9,89.9,94.9,95.9,100]; % letter grad...

7 jours ago | 0

Answered

Bestfit value doesn't match with the plotted value

Because you used gaussian_fn= @(q,x) (q(1)^2.*exp(-2.*((x-q(2)).^2)/q(3).^2)); as your fitting function -- in which q(1) is sq...

Bestfit value doesn't match with the plotted value

Because you used gaussian_fn= @(q,x) (q(1)^2.*exp(-2.*((x-q(2)).^2)/q(3).^2)); as your fitting function -- in which q(1) is sq...

7 jours ago | 0

| accepted

Answered

Groupsummary on timetable with cell/matrix data

Took a little head-scratching, but the following appears to work as desired-- fnMN3=@(c){mean(cat(3,c{:}),3)}; % functio...

Groupsummary on timetable with cell/matrix data

Took a little head-scratching, but the following appears to work as desired-- fnMN3=@(c){mean(cat(3,c{:}),3)}; % functio...

7 jours ago | 0

| accepted

Answered

How to calculate the coefficient of variation in Matlab

N=30; mn=mean(reshape([time(:),speed(:)],N,[])); sd=std(reshape([time(:),speed(:)],N,[])); cv=reshape(mn./sd,[],N); return...

How to calculate the coefficient of variation in Matlab

N=30; mn=mean(reshape([time(:),speed(:)],N,[])); sd=std(reshape([time(:),speed(:)],N,[])); cv=reshape(mn./sd,[],N); return...

8 jours ago | 0

| accepted

Answered

No legend when plotting fit object

Doesn't seem to be any way to prevent the builtin fit object plot() routine from adding the legend. Instead, use plot(x,myfit(...

No legend when plotting fit object

Doesn't seem to be any way to prevent the builtin fit object plot() routine from adding the legend. Instead, use plot(x,myfit(...

8 jours ago | 0

| accepted

Answered

How to create a new array with specific column and row thresholds from txt file

Why do you keep reverting to the hardest way possible to read in a data file? We just showed how easy it is to use readtable @...

How to create a new array with specific column and row thresholds from txt file

Why do you keep reverting to the hardest way possible to read in a data file? We just showed how easy it is to use readtable @...

8 jours ago | 0

Answered

Multiple 2D plots in 1 3D plot

Well, your data look nothing at all like those in the sample plot and your vectors aren't of commensurate lengths, but-- plot3(...

Multiple 2D plots in 1 3D plot

Well, your data look nothing at all like those in the sample plot and your vectors aren't of commensurate lengths, but-- plot3(...

8 jours ago | 0

| accepted

Answered

Loading a 600 mb file ends up astronomically large

Attach the file (or at least a portion of it). Memory usage is only 1:1 with disk storage for numeric data types stored as stre...

Loading a 600 mb file ends up astronomically large

Attach the file (or at least a portion of it). Memory usage is only 1:1 with disk storage for numeric data types stored as stre...

8 jours ago | 0

Answered

Reading csv file and counting number of lines that have a category of interest and are below a threshold

>> data=readtable('SampleDataset03.csv'); >> sum(contains(data.Category,'A')&data.Value<0.5) ans = 64 >> For this you d...

Reading csv file and counting number of lines that have a category of interest and are below a threshold

>> data=readtable('SampleDataset03.csv'); >> sum(contains(data.Category,'A')&data.Value<0.5) ans = 64 >> For this you d...

8 jours ago | 0

| accepted