Answered

How to plot a histogram object

bar(foo(3).BinEdges(2:end),foo(3).BinCounts) or |doc histogram| recommends |save/loadfig|

How to plot a histogram object

bar(foo(3).BinEdges(2:end),foo(3).BinCounts) or |doc histogram| recommends |save/loadfig|

3 hours ago | 0

Answered

Why arent the labels and ticks being ran in my code?

Wrong order, call |plot| last *or* use hold on before |plot| to keep what's already been drawn. BTW, I strongly suspe...

Why arent the labels and ticks being ran in my code?

Wrong order, call |plot| last *or* use hold on before |plot| to keep what's already been drawn. BTW, I strongly suspe...

3 hours ago | 0

Answered

3D bar y axis problem

OK, try this... % first just make some similar sample data... z1=repmat([0.07 0.062 0.055 0.05].',1,3); z1=z1+rand(si...

3D bar y axis problem

OK, try this... % first just make some similar sample data... z1=repmat([0.07 0.062 0.055 0.05].',1,3); z1=z1+rand(si...

5 hours ago | 0

Answered

how to input multiple items given a prompt?

You can input whatever you wish at the prompt as long as it's a valid ML expression. >> input('?') ?[2, pi, sqrt(10)] ans...

how to input multiple items given a prompt?

You can input whatever you wish at the prompt as long as it's a valid ML expression. >> input('?') ?[2, pi, sqrt(10)] ans...

1 day ago | 0

| accepted

Answered

MATLAB Answers Wish-list #4 (and bug reports)

I wish the ability to Delete or Close a Q? while someone is preparing an Answer could be disabled -- several times I have just f...

MATLAB Answers Wish-list #4 (and bug reports)

I wish the ability to Delete or Close a Q? while someone is preparing an Answer could be disabled -- several times I have just f...

1 day ago | 4

Answered

Saving struct to an Excel file

s.rev='Rev 1'; s.ymin=1; s.pkpk=rand(3,1); s.pkpkDB=rand(3,1); >> struct2table(s,'AsArray',1) ans = 1×4 tabl...

Saving struct to an Excel file

s.rev='Rev 1'; s.ymin=1; s.pkpk=rand(3,1); s.pkpkDB=rand(3,1); >> struct2table(s,'AsArray',1) ans = 1×4 tabl...

3 days ago | 0

Answered

How to fill the remaining "N" number of rows, of an already populated vector, with zeros

Alternatively, and _perhaps_ more efficient depending upon how |GV| is generated/obtained... GV(Ntotal,1)=0; ...

How to fill the remaining "N" number of rows, of an already populated vector, with zeros

Alternatively, and _perhaps_ more efficient depending upon how |GV| is generated/obtained... GV(Ntotal,1)=0; ...

3 days ago | 0

Answered

Open a text file and count the number of digits

function [num,n] = digit_counter(filename) % Returns total number and optional distribution of integers 0 thru 9 % in te...

Open a text file and count the number of digits

function [num,n] = digit_counter(filename) % Returns total number and optional distribution of integers 0 thru 9 % in te...

3 days ago | 0

| accepted

Answered

find multiple maximum imaginary part

Yes, [Mcamp,m] = max(imag(camp)); returns only the index _m_ of the first element if there are multiple maxima in a col...

find multiple maximum imaginary part

Yes, [Mcamp,m] = max(imag(camp)); returns only the index _m_ of the first element if there are multiple maxima in a col...

4 days ago | 1

| accepted

Answered

Is there a function that performs element by element multiplication between two variables and stores in one of the variable by default?

Sure, there's a function for virtually _everything_ in Matlab...all operators are are aliases for the underlying functions. ...

Is there a function that performs element by element multiplication between two variables and stores in one of the variable by default?

Sure, there's a function for virtually _everything_ in Matlab...all operators are are aliases for the underlying functions. ...

4 days ago | 0

Answered

Scatter use different colors for data-points

Close, but... :) (Always a "but", isn't there or wouldn't be asking a Q?) <VBG> colors = [[1 0 0] [0 1 0] [0 0 1] [1 1 0]...

Scatter use different colors for data-points

Close, but... :) (Always a "but", isn't there or wouldn't be asking a Q?) <VBG> colors = [[1 0 0] [0 1 0] [0 0 1] [1 1 0]...

4 days ago | 1

| accepted

Answered

How to Print a Numerical Vector to a List?

fmt=[' +,' repmat('%d,',1,8)]; % format w/ extra blank each line for delimiter later str=split(sprintf(fmt,vec),' '); ...

How to Print a Numerical Vector to a List?

fmt=[' +,' repmat('%d,',1,8)]; % format w/ extra blank each line for delimiter later str=split(sprintf(fmt,vec),' '); ...

5 days ago | 0

| accepted

Answered

How to loop fopen/fread/fseek to analyze large binary files in shorter segments ?

file=('C:\Users\Admin\Documents\MATLAB\EOD examples\Examples 16ch\copy.mat'); fid=fopen(file,'r'); n_ch=16; ...

How to loop fopen/fread/fseek to analyze large binary files in shorter segments ?

file=('C:\Users\Admin\Documents\MATLAB\EOD examples\Examples 16ch\copy.mat'); fid=fopen(file,'r'); n_ch=16; ...

5 days ago | 1

| accepted

Answered

Importing large datasheet while ignoring randomly placed non-numeric data

dataArray=cell2mat(textscan(fileID,'','TreatAsEmpty', repmat('*',1,15),'CollectOutput',1)); Make sure my old eyes counted...

Importing large datasheet while ignoring randomly placed non-numeric data

dataArray=cell2mat(textscan(fileID,'','TreatAsEmpty', repmat('*',1,15),'CollectOutput',1)); Make sure my old eyes counted...

7 days ago | 0

Answered

Plotting distance of each point in a grid from a mean

M=size(Xtr,1); N=size(ttr,1); mnXtr=mean(Xtr(Xtr~=0),:); [X Y]=meshgrid(linspace(-0.5, 1.0, M),linspace(-0.5, 1..0, N...

Plotting distance of each point in a grid from a mean

M=size(Xtr,1); N=size(ttr,1); mnXtr=mean(Xtr(Xtr~=0),:); [X Y]=meshgrid(linspace(-0.5, 1.0, M),linspace(-0.5, 1..0, N...

8 days ago | 0

Answered

Using interp1 with multiple data that meets criteria - Looking to have interp 1 return the max value

Your example code returns ix=4.5; interp1(DATA(:,2),DATA(:,3),ix) ans = 6.0309 rather than 4.5; that result wou...

Using interp1 with multiple data that meets criteria - Looking to have interp 1 return the max value

Your example code returns ix=4.5; interp1(DATA(:,2),DATA(:,3),ix) ans = 6.0309 rather than 4.5; that result wou...

8 days ago | 0

Answered

How to perform FFT on a signal with a 5 Hz frequency resolution?

The FFT resolution is based on the length of the data sample and the sample rate and the length of the computed FFT. If ...

How to perform FFT on a signal with a 5 Hz frequency resolution?

The FFT resolution is based on the length of the data sample and the sample rate and the length of the computed FFT. If ...

8 days ago | 1

| accepted

Answered

Plotting multiple graph in same graph

... for j = 1: 2 : size(READ,2) c = c+1; clf ... Well, you wipe out everything up to here--if ...

Plotting multiple graph in same graph

... for j = 1: 2 : size(READ,2) c = c+1; clf ... Well, you wipe out everything up to here--if ...

8 days ago | 1

| accepted

Answered

How to connect lines of a scatter plot?

Well, the simple way is to do the plot of the data without the NaN elements; the builtin behavior is to ignore NaN and that's no...

How to connect lines of a scatter plot?

Well, the simple way is to do the plot of the data without the NaN elements; the builtin behavior is to ignore NaN and that's no...

8 days ago | 0

Answered

How to show the values are constant inside a cell array

Presuming interpreted the meaning of "constant" in each cell, >> c{:} % small demo cell array first,last ...

How to show the values are constant inside a cell array

Presuming interpreted the meaning of "constant" in each cell, >> c{:} % small demo cell array first,last ...

9 days ago | 0

Answered

How can I plot a Pareto Chart (Y-axis= Qty VS. X-axis = Part Description) for the attached Excel data table?

A={1 30 'ARD'; 2 25 'CDE'; 3 22 'BTS'; 4 10 'RSD'; 5 5 'TSE'; 6 4 'DMP'; 7 3 'MTR'; ...

How can I plot a Pareto Chart (Y-axis= Qty VS. X-axis = Part Description) for the attached Excel data table?

A={1 30 'ARD'; 2 25 'CDE'; 3 22 'BTS'; 4 10 'RSD'; 5 5 'TSE'; 6 4 'DMP'; 7 3 'MTR'; ...

9 days ago | 1

| accepted

Answered

Calculate error bar and plot them

<https://www.mathworks.com/matlabcentral/answers/379570-how-can-i-place-my-error-bar-in-separate-bar-center#answer_302325 Answer...

Calculate error bar and plot them

<https://www.mathworks.com/matlabcentral/answers/379570-how-can-i-place-my-error-bar-in-separate-bar-center#answer_302325 Answer...

10 days ago | 0

Answered

how to remove image extension so that only numbered name can be stored in a database

n=sscanf(fname,'%d.jpg') or [~,name]=fileparts(fname); n=str2num(n);

how to remove image extension so that only numbered name can be stored in a database

n=sscanf(fname,'%d.jpg') or [~,name]=fileparts(fname); n=str2num(n);

12 days ago | 0

| accepted

Answered

I have a time series daily data points from Jan-1-2007 to March-31-2011 which is 1642 data points. How to plot the CDF of the same?

Because |ecdf| returns the percentiles at the _*unique*_ locations in the input vector returned in the optional second output va...

I have a time series daily data points from Jan-1-2007 to March-31-2011 which is 1642 data points. How to plot the CDF of the same?

Because |ecdf| returns the percentiles at the _*unique*_ locations in the input vector returned in the optional second output va...

12 days ago | 0

| accepted

Answered

Suppose I have three vector x1,x2 and Y. Iam using optimization algorithm, I want maximum value of Y by using C=max(Y) I can extract the value and the value of x1 and x2 which are giving max Y value accordingly extracted, but I need the min value of

mxy=max(Y); % find max Y iy=find(Y==mxy); % all locations == max mxymnx=min(X(iy)); % find corresponding ...

Suppose I have three vector x1,x2 and Y. Iam using optimization algorithm, I want maximum value of Y by using C=max(Y) I can extract the value and the value of x1 and x2 which are giving max Y value accordingly extracted, but I need the min value of

mxy=max(Y); % find max Y iy=find(Y==mxy); % all locations == max mxymnx=min(X(iy)); % find corresponding ...

14 days ago | 0

| accepted

Answered

Spliting a n-by-3 Array into several different arrays.

|v| is _not_ a vector but an array. Star's code works on a vector; would be painful to extend to an array I think, as is. _B...

Spliting a n-by-3 Array into several different arrays.

|v| is _not_ a vector but an array. Star's code works on a vector; would be painful to extend to an array I think, as is. _B...

14 days ago | 0

| accepted

Answered

Repeat for-loop from the beginning after recalculating values

Directly addressing the Q?, here's a basic function to do the removal-- function x=thompsontau(x) % Return array x w/ ou...

Repeat for-loop from the beginning after recalculating values

Directly addressing the Q?, here's a basic function to do the removal-- function x=thompsontau(x) % Return array x w/ ou...

14 days ago | 0

| accepted

Answered

how to specify the X and Y ticklable?

|X,YTick| and |X,YTickLabel| are integrally coupled together -- you must label every tick with a label (or a blank string if don...

how to specify the X and Y ticklable?

|X,YTick| and |X,YTickLabel| are integrally coupled together -- you must label every tick with a label (or a blank string if don...

14 days ago | 0

Answered

How to animate line on polar axes plots

polar coordinates are "red-haired stepchildren" in Matlab, for sure. I've not played with the new(ish) |PolarAxes|, but I t...

How to animate line on polar axes plots

polar coordinates are "red-haired stepchildren" in Matlab, for sure. I've not played with the new(ish) |PolarAxes|, but I t...

15 days ago | 1

| accepted

Answered

Repeat for-loop from the beginning after recalculating values

The first loop can be eliminated entirely--use the Matlab array syntax: x_31=mean(P31,'omitnan'); SDP_31=std(P31,'om...

Repeat for-loop from the beginning after recalculating values

The first loop can be eliminated entirely--use the Matlab array syntax: x_31=mean(P31,'omitnan'); SDP_31=std(P31,'om...

15 days ago | 0