11,897 total contributions since 2009

It is easier to solve a problem than to guess, what the problem is.

Questions about FileExchange submissions are welcome - get my address from the code. I do not answer mails concerning questions in the forum.

Answered

Numercial Iterations using Loop

This is strange: function [vAn,vNum] = Q3_STNO(T,N,m,d) You do not create the outputs vAn and vNum. The inputs T,N,m,d are ove...

Numercial Iterations using Loop

This is strange: function [vAn,vNum] = Q3_STNO(T,N,m,d) You do not create the outputs vAn and vNum. The inputs T,N,m,d are ove...

9 hours ago | 0

| accepted

Answered

Im struggling with why this while loop returns zeros and more or less how to get all the matricies in the while loop to be the same size. Thanks for any and all help in advance. Also M is from an excel document and has 125 values while n is 5.

I assume your code will be much clearer with a for loop and a switch block: L = length(M); for Uo = 1:n switch Uo ca...

Im struggling with why this while loop returns zeros and more or less how to get all the matricies in the while loop to be the same size. Thanks for any and all help in advance. Also M is from an excel document and has 125 values while n is 5.

I assume your code will be much clearer with a for loop and a switch block: L = length(M); for Uo = 1:n switch Uo ca...

10 hours ago | 2

Answered

English as default Mathworks language

On the bottom of the page, there is a "button" to select the language: A rectangle with rounded corners and the current language...

English as default Mathworks language

On the bottom of the page, there is a "button" to select the language: A rectangle with rounded corners and the current language...

11 hours ago | 0

| accepted

Answered

Trying to do polynomial interpolation but I get a matrix full of zeros (almost)

Why do you assume, that the matrix A contains zeros? It does not: x = [150, 200, 300, 500, 1000, 2000, 99999]'; y = [2, 3, 4, ...

Trying to do polynomial interpolation but I get a matrix full of zeros (almost)

Why do you assume, that the matrix A contains zeros? It does not: x = [150, 200, 300, 500, 1000, 2000, 99999]'; y = [2, 3, 4, ...

12 hours ago | 0

| accepted

Answered

how to write a program to round numbers

Rounding is the same as adding 0.5 and cropping the fractional part of the number. For negative numbers you have to subtract 0....

how to write a program to round numbers

Rounding is the same as adding 0.5 and cropping the fractional part of the number. For negative numbers you have to subtract 0....

12 hours ago | 0

Answered

add image to gui

If you want to fill the complete screen with an image, you can use this under Windows: FileExchange: WindowAPI : FigH = figure...

add image to gui

If you want to fill the complete screen with an image, you can use this under Windows: FileExchange: WindowAPI : FigH = figure...

15 hours ago | 0

Answered

Saving a figure as a png with a specific name from predefined variable

With some guessing: saveas(gcf, [plottitle, '.bmp'])

Saving a figure as a png with a specific name from predefined variable

With some guessing: saveas(gcf, [plottitle, '.bmp'])

1 day ago | 0

Answered

How to delete elements from structure

If you want to delete a field, use rmfield: cell.population = rmfield(cell.population, 'type') Of course, this removes the fie...

How to delete elements from structure

If you want to delete a field, use rmfield: cell.population = rmfield(cell.population, 'type') Of course, this removes the fie...

1 day ago | 0

Answered

Can xlswrite be used to append information

You can import the data from te existing Excel file, determine the size, and insert the new data at the required location. You f...

Can xlswrite be used to append information

You can import the data from te existing Excel file, determine the size, and insert the new data at the required location. You f...

1 day ago | 1

| accepted

Answered

I have created a matrix out of another matrix. I now want to find the index values for those specific numbers in the 2nd matrix FROM the 1st matrix. How would I go about doing that?

[ex, index] = ismember(matrix_2, matrix_1, 'rows')

I have created a matrix out of another matrix. I now want to find the index values for those specific numbers in the 2nd matrix FROM the 1st matrix. How would I go about doing that?

[ex, index] = ismember(matrix_2, matrix_1, 'rows')

1 day ago | 0

| accepted

Answered

How can I speed up "writetable" for large tables?

According to https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3 : ...

How can I speed up "writetable" for large tables?

According to https://support.office.com/en-us/article/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3 : ...

1 day ago | 0

Answered

dlmwrite gives error message Too many output arguments.

Use the debugger. It is the best friend of the programmer. dlmwrite stops in line 104. This is the error handling part of a TRY...

dlmwrite gives error message Too many output arguments.

Use the debugger. It is the best friend of the programmer. dlmwrite stops in line 104. This is the error handling part of a TRY...

1 day ago | 2

| accepted

Answered

How to display data from editext in listbox in GUI ?

UNTESTED!!! function yourGUI StrList = {'a', 'an', 'able', 'back', 'car', 'create'}; H.Fig = figure('Position', [100, 100, ...

How to display data from editext in listbox in GUI ?

UNTESTED!!! function yourGUI StrList = {'a', 'an', 'able', 'back', 'car', 'create'}; H.Fig = figure('Position', [100, 100, ...

1 day ago | 1

Answered

Index exceeds the number of array elements .Please help??

x = linspace(0,10000) This creates 100 elements netwee 0 and 10000. Then x(k) will fail at k=101. The debugger allows for find...

Index exceeds the number of array elements .Please help??

x = linspace(0,10000) This creates 100 elements netwee 0 and 10000. Then x(k) will fail at k=101. The debugger allows for find...

1 day ago | 0

Answered

How to convert decimal into binary?

This code shows '11111111' only, because you overwrite the output in each iteration: n= 8; for i = 0:2^n-1 x = dec2bin(i,8...

How to convert decimal into binary?

This code shows '11111111' only, because you overwrite the output in each iteration: n= 8; for i = 0:2^n-1 x = dec2bin(i,8...

1 day ago | 0

| accepted

Answered

How can i creat subvectors ?

With File Exchange: RunLength : a = [1 2 5 NaN NaN 9 0 23 12 NaN 6 2 8]; [B, N, Ind] = RunLength(isnan(a)); match = (~B); N...

How can i creat subvectors ?

With File Exchange: RunLength : a = [1 2 5 NaN NaN 9 0 23 12 NaN 6 2 8]; [B, N, Ind] = RunLength(isnan(a)); match = (~B); N...

1 day ago | 0

Answered

Timer object is only executing part of the timerfcn on second and later iterations.

If you use function instead of anonymous functions, you can use the debugger easily to see, what's going on. t.TimerFcn = {@my...

Timer object is only executing part of the timerfcn on second and later iterations.

If you use function instead of anonymous functions, you can use the debugger easily to see, what's going on. t.TimerFcn = {@my...

1 day ago | 0

Answered

MATLAB 2017a unable to detect MS Visual C++ 2017 compiler

Look at the list of supported compilers: https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files...

MATLAB 2017a unable to detect MS Visual C++ 2017 compiler

Look at the list of supported compilers: https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files...

1 day ago | 0

Answered

Repeat all operations for n rows inside an array (with n unknown)

M = [0.3 0.4 4; ... 0.5 0.6 3.1]; nRow = size(M, 1); for iRow = 1:nRow yourOperation(M(iRopw, :)) ... end I...

Repeat all operations for n rows inside an array (with n unknown)

M = [0.3 0.4 4; ... 0.5 0.6 3.1]; nRow = size(M, 1); for iRow = 1:nRow yourOperation(M(iRopw, :)) ... end I...

1 day ago | 1

Answered

Insert smaller matrix into larger matrix with an equal number of columns.

X = 10; Y = 35; The problem is that X:Y has 26 elements, not 25. Remember: If A has 1 row only, you will not use: 10:11 but 10...

Insert smaller matrix into larger matrix with an equal number of columns.

X = 10; Y = 35; The problem is that X:Y has 26 elements, not 25. Remember: If A has 1 row only, you will not use: 10:11 but 10...

1 day ago | 0

| accepted

Answered

Axes Click in GUI interrupts Figure Plot

imshow(frame); shows the image in the current axes. If you click on an axes, e.g. handles.graph1, you make it active. Then ...

Axes Click in GUI interrupts Figure Plot

imshow(frame); shows the image in the current axes. If you click on an axes, e.g. handles.graph1, you make it active. Then ...

1 day ago | 0

Answered

How do I delete a row in a table containing certain text?

You are almost there. isequal(indices.CalendarYear, 'Total:') This tests, if indices.CalenderYear is equal to the char vector ...

How do I delete a row in a table containing certain text?

You are almost there. isequal(indices.CalendarYear, 'Total:') This tests, if indices.CalenderYear is equal to the char vector ...

1 day ago | 1

| accepted

Answered

Splitting Cell Arrays into smaller ones of specific length

The question is not clear. Which class and type should "values 1:6" be? Do not hide indices in the name of variables. The dynam...

Splitting Cell Arrays into smaller ones of specific length

The question is not clear. Which class and type should "values 1:6" be? Do not hide indices in the name of variables. The dynam...

1 day ago | 1

| accepted

Answered

Concatenate a file path in copyfile

Do not use cd to affect the current directory. Remember that a callback of a GUI or timer can change the current folder unexpect...

Concatenate a file path in copyfile

Do not use cd to affect the current directory. Remember that a callback of a GUI or timer can change the current folder unexpect...

1 day ago | 0

| accepted

Answered

Do we have an efficient way to do this matrix multiplication?

Matlab calls optimized functions for sparse matrix multiplications already. Sometime we had an acceleration with hard-coded spar...

Do we have an efficient way to do this matrix multiplication?

Matlab calls optimized functions for sparse matrix multiplications already. Sometime we had an acceleration with hard-coded spar...

1 day ago | 2

| accepted

Answered

How to fill in missing rows in a Matrix

% Create the full array manually: v = (0:0.02:1.5).'; k = [0.5, 0.45].'; % I cannot guess which values you have here M(:, 2:...

How to fill in missing rows in a Matrix

% Create the full array manually: v = (0:0.02:1.5).'; k = [0.5, 0.45].'; % I cannot guess which values you have here M(:, 2:...

1 day ago | 0

| accepted

Answered

How do i Use a filename that was loaded in a function to label the Legend of my figure ?

Callbacks do not reply outputs. The output "filename" of the function addplot() is sent into the nirvana. You cannot expect that...

How do i Use a filename that was loaded in a function to label the Legend of my figure ?

Callbacks do not reply outputs. The output "filename" of the function addplot() is sent into the nirvana. You cannot expect that...

2 days ago | 1

Answered

Vectorization of matrices multiplication

h = dot(PointsA - PointsB, normals).' or h = sum((PointsA - PointsB) .* normals, 1).'

Vectorization of matrices multiplication

h = dot(PointsA - PointsB, normals).' or h = sum((PointsA - PointsB) .* normals, 1).'

2 days ago | 2

| accepted

Answered

i have a double array and i want to convert that to an image but when i am doing so all the pixel values is getting converted to 255

Maybe all you have to do is to normalize the array: % Normalize the range [0, a] to [0, 1] img = X / max(X(:)); If the origin...

i have a double array and i want to convert that to an image but when i am doing so all the pixel values is getting converted to 255

Maybe all you have to do is to normalize the array: % Normalize the range [0, a] to [0, 1] img = X / max(X(:)); If the origin...

3 days ago | 0

Answered

How do I continuously read the mouse position as the mouse is moving only on axes on a figure

See https://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/ Use the 'WindowButtonMotionFcn' and d...

How do I continuously read the mouse position as the mouse is moving only on axes on a figure

See https://blogs.mathworks.com/videos/2008/05/27/advanced-matlab-capture-mouse-movement/ Use the 'WindowButtonMotionFcn' and d...

3 days ago | 1

| accepted