Answered

Using fzero to keep tolerance within limits

As the error message says, you need a function name/handle as the argument to fzero not just an expression. >> fn=@(T)100*(0.15...

Using fzero to keep tolerance within limits

As the error message says, you need a function name/handle as the argument to fzero not just an expression. >> fn=@(T)100*(0.15...

2 hours ago | 0

Answered

Error using plot Vectors must be the same length.

On the right track, just have to use the index for both variables... index_liq = (M_CP==2); % index to...

Error using plot Vectors must be the same length.

On the right track, just have to use the index for both variables... index_liq = (M_CP==2); % index to...

3 hours ago | 0

Answered

Running all Nastran input .bdf files contained in a folder using Matlab

files = dir('*.bdf'); for i = 1 : length(files) filename = files(K).name; system('D:\MSC.Software\MSC_Nastran\20180\bin\n...

Running all Nastran input .bdf files contained in a folder using Matlab

files = dir('*.bdf'); for i = 1 : length(files) filename = files(K).name; system('D:\MSC.Software\MSC_Nastran\20180\bin\n...

5 hours ago | 0

Answered

Detrending a time series with NaN values

With recent (but I'm not sure just how recent) releases, there's the 'omitnan' optional parameter in detrend that will skip the ...

Detrending a time series with NaN values

With recent (but I'm not sure just how recent) releases, there's the 'omitnan' optional parameter in detrend that will skip the ...

18 hours ago | 0

Answered

Error using chckxy: The first input must contain unique values, while using only unique values

>> load dados >> whos x y Name Size Bytes Class Attributes x 1x58 464 double...

Error using chckxy: The first input must contain unique values, while using only unique values

>> load dados >> whos x y Name Size Bytes Class Attributes x 1x58 464 double...

20 hours ago | 0

Answered

How to convert memory to Megabyte

>> m=memory; >> sprintf('%.0f MB',m.MemUsedMATLAB/(1024^2)) ans = '2305 MB' >>

How to convert memory to Megabyte

>> m=memory; >> sprintf('%.0f MB',m.MemUsedMATLAB/(1024^2)) ans = '2305 MB' >>

22 hours ago | 0

| accepted

Answered

How do I set the some letters in an Excel sheet cell to 'BOLD' through ACTXSERVER using MATLAB (R2019a)?

This isn't MATLAB per se, but Excel VBA/object model syntax Q? A sample VBA function would look something like lngPos = InStr(...

How do I set the some letters in an Excel sheet cell to 'BOLD' through ACTXSERVER using MATLAB (R2019a)?

This isn't MATLAB per se, but Excel VBA/object model syntax Q? A sample VBA function would look something like lngPos = InStr(...

1 day ago | 0

Answered

Generating a normal distrbution random numbers and setting them to catagories

function [abc,ABC]=random_gen(n) r=randn(n,1); % generate column vector N rn ix=disc...

Generating a normal distrbution random numbers and setting them to catagories

function [abc,ABC]=random_gen(n) r=randn(n,1); % generate column vector N rn ix=disc...

3 days ago | 0

Answered

Change color of numbers at colorbar

Undocumented property -- underneath is a NumericRuler object which does control the axes ticklabels independently. figure surf...

Change color of numbers at colorbar

Undocumented property -- underneath is a NumericRuler object which does control the axes ticklabels independently. figure surf...

3 days ago | 0

| accepted

Answered

Plot year as major ticks and months as minor ticks

If your time data are evenly-spaced and at monthly intervals, hAx=gca; hX=hAx.XAxis; % get handle to X datetime ruler...

Plot year as major ticks and months as minor ticks

If your time data are evenly-spaced and at monthly intervals, hAx=gca; hX=hAx.XAxis; % get handle to X datetime ruler...

3 days ago | 0

Answered

URGENT help on TSA with tach signal

I've not used it, but doc (and error message) indicate that the time pulse input is either a fixed scalar or increasing time for...

URGENT help on TSA with tach signal

I've not used it, but doc (and error message) indicate that the time pulse input is either a fixed scalar or increasing time for...

3 days ago | 0

| accepted

Answered

plotting group size vs total member in group of particular size

v =[1 1 1 2 2 3 4 4 5]; % engine u=unique(v); ng=histc(v,u); U=unique(ng) U = 1 2 3 NU=histc(ng,U) ans ...

plotting group size vs total member in group of particular size

v =[1 1 1 2 2 3 4 4 5]; % engine u=unique(v); ng=histc(v,u); U=unique(ng) U = 1 2 3 NU=histc(ng,U) ans ...

3 days ago | 0

| accepted

Answered

Convert a Complex Number to exponential real

MATLAB has builtin functions abs (or hypot()) and angle() for the above explicit implementations... >> x=complex(2,5); >> cm...

Convert a Complex Number to exponential real

MATLAB has builtin functions abs (or hypot()) and angle() for the above explicit implementations... >> x=complex(2,5); >> cm...

3 days ago | 1

Answered

Extracting elements from one matrix and placing in another

MATLAB assigns the complete array to the LHS without having used subscrpting to indicate you want to place each plane extracted ...

Extracting elements from one matrix and placing in another

MATLAB assigns the complete array to the LHS without having used subscrpting to indicate you want to place each plane extracted ...

3 days ago | 1

Answered

Listing C: folder contents

"The dir command in the Windows command shell behaves in this way, but that's no reason for the MATLAB command to do the same th...

Listing C: folder contents

"The dir command in the Windows command shell behaves in this way, but that's no reason for the MATLAB command to do the same th...

4 days ago | 0

Answered

How to print strings from a data text file that is in correlation to an indices text file?

Put the indices into a 3D array and just index -- indices(:,:,1)=[1 6 2 3; 3 2 4 0; 1 6 4 7; 0 1 4 7; ... 0 5 ...

How to print strings from a data text file that is in correlation to an indices text file?

Put the indices into a 3D array and just index -- indices(:,:,1)=[1 6 2 3; 3 2 4 0; 1 6 4 7; 0 1 4 7; ... 0 5 ...

4 days ago | 0

| accepted

Answered

How to improve efficiency when checking for unique combinations of table values?

tFruit=readtable('fruit.txt'); tFruit=tFruit(:,[1:2:end]); tFruit.Properties.VariableNames={'Fruit','Color','Data'}; tFruit.F...

How to improve efficiency when checking for unique combinations of table values?

tFruit=readtable('fruit.txt'); tFruit=tFruit(:,[1:2:end]); tFruit.Properties.VariableNames={'Fruit','Color','Data'}; tFruit.F...

5 days ago | 0

Answered

Removing Leading Spaces before xml tags at each line.

The tool seems to format the file to reflect the XML structure; dunno why it would necessarily hurt, but I don't do such things ...

Removing Leading Spaces before xml tags at each line.

The tool seems to format the file to reflect the XML structure; dunno why it would necessarily hurt, but I don't do such things ...

5 days ago | 1

| accepted

Answered

How can I solve multiple equations? (Pipeline Design)

function Pc=pipelineExternalPC(d,t,sy) % Usage: % Pc=pipelineExternalPC(d,t,sy) % % returns Pc, pipeline external collapse...

How can I solve multiple equations? (Pipeline Design)

function Pc=pipelineExternalPC(d,t,sy) % Usage: % Pc=pipelineExternalPC(d,t,sy) % % returns Pc, pipeline external collapse...

6 days ago | 1

| accepted

Answered

Define a matrix in terms of kronecker product

>> I=3;N=4; >> kron(ones(1,N),eye(I)) ans = 1 0 0 1 0 0 1 0 0 1 0 0 0 ...

Define a matrix in terms of kronecker product

>> I=3;N=4; >> kron(ones(1,N),eye(I)) ans = 1 0 0 1 0 0 1 0 0 1 0 0 0 ...

6 days ago | 0

Answered

Scientific notation at y-axis with "ax.YAxis.Exponent"

Well, here's a crude first pass... expn=floor(log10(yticks)); mant=yticks./10.^(expn); lbls=cellstr(num2str([mant;expn].','%d...

Scientific notation at y-axis with "ax.YAxis.Exponent"

Well, here's a crude first pass... expn=floor(log10(yticks)); mant=yticks./10.^(expn); lbls=cellstr(num2str([mant;expn].','%d...

8 days ago | 0

| accepted

Answered

Scientific notation at y-axis with "ax.YAxis.Exponent"

I don't see a user-settable format to force the notation (although I didn't use Yair's getundoc to poke) with arbitrary tick val...

Scientific notation at y-axis with "ax.YAxis.Exponent"

I don't see a user-settable format to force the notation (although I didn't use Yair's getundoc to poke) with arbitrary tick val...

8 days ago | 0

Answered

FFT, dominant frequency doesnt match time domain?

Your problem is simply that the dominant frequency isn't the same as one of the frequency bin midpoints depending on the number ...

FFT, dominant frequency doesnt match time domain?

Your problem is simply that the dominant frequency isn't the same as one of the frequency bin midpoints depending on the number ...

9 days ago | 2

| accepted

Answered

Change one line in Excel file

I'd avoid xlswrite and use writecell instead. Use the 'Range' parameter to put in the right place and not disturb anything else...

Change one line in Excel file

I'd avoid xlswrite and use writecell instead. Use the 'Range' parameter to put in the right place and not disturb anything else...

9 days ago | 0

Answered

How to find the find the pattern in each row of Matrix?

A=[A;A(3,:)]; % make sure one row has same pattern % the engine B=(A~=0); ...

How to find the find the pattern in each row of Matrix?

A=[A;A(3,:)]; % make sure one row has same pattern % the engine B=(A~=0); ...

9 days ago | 1

Answered

How to make segmented regression line and determine the breakpoints?

I've answered this several time in the past, but never think to keep a link... https://www.mathworks.com/matlabcentral/answers/...

How to make segmented regression line and determine the breakpoints?

I've answered this several time in the past, but never think to keep a link... https://www.mathworks.com/matlabcentral/answers/...

10 days ago | 0

Answered

Conditional Scatter plotting based on third data set

>> SX=1*all(M==1)+2*(any(M==2)&any(M==3))+3*all(M==3) SX = 2 1 2 1 3 >> Create categorical variable fr...

Conditional Scatter plotting based on third data set

>> SX=1*all(M==1)+2*(any(M==2)&any(M==3))+3*all(M==3) SX = 2 1 2 1 3 >> Create categorical variable fr...

10 days ago | 0

Answered

callculating values using cfit object with multiple p values

I don't see any syntax by which to do that with the coefficents for multiple fits stored that way and the doc for cfit explicitl...

callculating values using cfit object with multiple p values

I don't see any syntax by which to do that with the coefficents for multiple fits stored that way and the doc for cfit explicitl...

10 days ago | 0

Answered

While loop to get a specific section of data

Far easier if you would attach a (small) sample of the dataset, but the general idea would be thresholdUp=1; ...

While loop to get a specific section of data

Far easier if you would attach a (small) sample of the dataset, but the general idea would be thresholdUp=1; ...

11 days ago | 0

| accepted

Answered

How to count "gaps" consisting of designated values in a vector and obtain start and end indices?

v=sprintf('%d',ismember(sample_data_vector,invalid_values)|isnan(sample_data_vector)); iStart=strfind(v,'01')+1; iEnd=strfind(...

How to count "gaps" consisting of designated values in a vector and obtain start and end indices?

v=sprintf('%d',ismember(sample_data_vector,invalid_values)|isnan(sample_data_vector)); iStart=strfind(v,'01')+1; iEnd=strfind(...

11 days ago | 0