# Walter Roberson

I do not do free private consulting. If you want to bring my attention to something, send a link to the MATLAB Answers location. I am currently caught up to T0099119; if you are waiting on a reply from me for an older issue, please send me a reminder.

**Programming Languages:**

C, MATLAB, Shell, Perl, Fortran

**Spoken Languages:**

English

**Statistics**

RANK**1**

of 277,937

REPUTATION**131,374**

CONTRIBUTIONS

**36** Questions

**58,313** Answers

ANSWER ACCEPTANCE **
50.0%
**

VOTES RECEIVED**17,456**

RANK

of 18,801

REPUTATION**N/A**

AVERAGE RATING**0.00**

CONTRIBUTIONS**0** Files

DOWNLOADS **0**

ALL TIME DOWNLOADS**0**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

pause function doesn't work R20a

Is that definitely the code? pause() without any parameter waits for a key to be pressed on the keyboard Exception: if pause ...

2 hours ago | 0

the best way to save .txt

You could consider using readcell and writecell ... but sometimes the easiest way is just to fopen / fprintf / fclose

2 hours ago | 0

Code generation failed due to unexpected object of type 'RootOf'.

D2ynum = solve(ode==0, D2y, 'maxdegree', 3);

19 hours ago | 0

| accepted

How do I display .mat file as an image in Matlab

example_matrix = im2uint8(1); should be (I) instead of (1)

19 hours ago | 0

Can I use parfeval in App Designer to plot to a UIAxes while the code keeps running?

Regardless of whether you use a parallel pool or the newer background pool, no parallel worker of any kind can directly affect t...

2 days ago | 1

how know size of field struct

What you failed to indicate is that Sis is a non-scalar struct. Sis.D is then "struct expansion". So size(Sis.D) is the same ...

3 days ago | 1

| accepted

include all rows matrix in []

zc = num2cell(z,1); %1 --> preserve first dimension [Sis.h] = zc{:}; %or [Sis.h] = deal(zc{:});

3 days ago | 1

| accepted

How can I iterate through all .txt files in a folder to process them with already written code?

projectdir = 'location/of/text/files'; dinfo = dir(fullfile(projectdir, '*.txt')); filenames = fullfile({dinfo.folder}, {din...

3 days ago | 0

| accepted

How we can use fminsearch with a vector as input and return a scaler as an output?

y is 1000 x 1. You are passing scalar 0 as the initial value for fminsearch() so at each step h will be 0 inside your gradient ...

3 days ago | 0

| accepted

How can I find the elapsed time between two images from video file with matlab.

Unfortunately, none of the common video formats record absolute time for frames. If you are using videoreader() then you can u...

4 days ago | 0

textscan does not scan the text as accurate as strread, i have "errors"

a = "C +01.314 +027.11 +01.225 +01.578 +01.579 Air" Result = textscan(a,'%s%f%f%f%f%f%s','Delimiter',' ', 'multi', true) ce...

4 days ago | 1

how do I turn a piece of code into a parametric optimisation

% % Matrix properties (8552 example) Em = 380E3; % Young's modulus num = 0.22; % Poisson's ratio Vv_vals = [0.01, 0.38, 0.47...

4 days ago | 0

| accepted

Problems using Plot function

You are plotting one point at a time. By default, plot() does not put in any markers, and plot() can only draw lines when there ...

4 days ago | 0

| accepted

A unknown bug on matrix

Consider: A = [3 2 1 0 -1 -2 -3] Are you expecting the result to be [3, 2, 1, (0-1-2-3)] --> [3, 2, 1, -6] a vector of 4 eleme...

4 days ago | 0

| accepted

How to solve this equation?

There are multiple solutions. p=0 is a solution for all a values, but there are also complex solutions -- and you did not rule o...

4 days ago | 0

| accepted

how to reduce time for this Convolutional Neural Network to get result?

See https://www.mathworks.com/help/stats/fitcecoc.html#d124e356431 for information on 'options' 'useparallel' for computation in...

4 days ago | 0

i need wave_gen function but i can't find it!!!

See https://www.mathworks.com/matlabcentral/answers/26814-use-of-wave_gen-function#answer_34917

5 days ago | 0

serialport / bluetooth issues

What that second post is telling you is that serialport() has an internal onCleanup that is invoked when serialport() detects th...

5 days ago | 0

looking for convenient way to extract matrix from 1*n*n

A = zeros(5,5,5) B = permute(sum(A,1), [2 3 1]); size(B) squeeze() is a convenience function that ends up invoking permute()....

5 days ago | 0

tiledlayout() "exceeds array bounds" when repeated running the script, but works when workspace cleared

tiledlayout.Padding = 'compact'; That creates a struct named tiledlayout <https://www.mathworks.com/help/matlab/ref/matl...

5 days ago | 0

trying to create a plot of cost per mile when the trailer weight increases in a program I wrote and i cannot get it to work.

You were doing well, but starting from 'diesel' when C==6 then you have elseif TW>2000 && TW<=4000 and...

5 days ago | 0

Simplifying equations with trigonometric terms written in terms of degrees and not radians

C2D = @(C) cosd(rad2deg(children(C, 1))) mapSymType(Expression, 'cos', C2D)

5 days ago | 1

Error using ' TRANSPOSE does not support N-D arrays. Use PAGETRANSPOSE/PAGECTRANSPOSE to transpose pages or PERMUTE to reorder dimensions of N-D arrays.

Your nc file has lat, long, one depth, and multiple times, making it a 4 dimensional array. You are trying to pcolor() the entir...

5 days ago | 1

| accepted

Unable to use ODE45 to model data, error with "Unable to meet integration tolerances without reducing the step size below the smallest value allowed (4.708773e-14) at time t."

c0=[0.0188,0]; A=beta(3)*c(1)^beta(1); B=beta(4)*c(2)^beta(2); I would think it is highly likely that that ode23t i...

5 days ago | 0

Help for matrix in matlab

prod(M, 2) sum(M, 2) min(M, 2) max(M, 2) any(M, 2) all(M, 2) std(M, [], 2) amongst others

6 days ago | 0

How to solve "Inf" from table calculation in GUI

your xtes and ytes are exactly the same so subtraction gives 0.

6 days ago | 2

uifigure alternatives for gcf, gcbf, gco, gcbo, gca, and any other legacy figure based functions

I used to think that those functions simplify didn't apply to uifigure and children. However someone indicated that the real iss...

6 days ago | 0

can you specify a newly created sheet to be at the start of a spreadsheet using writetable?

no, writetable cannot manipulate the tab order. If you happen to be using Windows see https://www.mathworks.com/matlabcentral...

6 days ago | 1

| accepted

helps to solve objective function with restriction, to obtain the value of the constant C

The integral of the density function must be exactly 1. The c is a constant multiplier. So if you calculate the integral without...

7 days ago | 1

All functions in a script must be closed with an 'end'.

Delete or comment out everything from the "function" line. * Your script never invokes the function * functions inside a scr...

7 days ago | 2