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

Problem with matrix indexing

The CPU time of the reshape command is very tiny, because it only checks if the number of elements is not changed and then it re...

Problem with matrix indexing

The CPU time of the reshape command is very tiny, because it only checks if the number of elements is not changed and then it re...

ongeveer 3 uur ago | 0

Answered

What MATLAB functions are underappreciated?

dbstop . Many newcomers mention, that they do not understand, what their code does. The possibility to step through it line by l...

What MATLAB functions are underappreciated?

dbstop . Many newcomers mention, that they do not understand, what their code does. The possibility to step through it line by l...

ongeveer 3 uur ago | 0

Answered

How to creat a pairwise comparison matrix using a for loop ?

A=[2 3; ... 4 7; ... 5 4; ... 2 1]; idx = nchoosek(1:size(A, 1), 2); B = A(idx(:, 1), :) - A(idx(:, ...

How to creat a pairwise comparison matrix using a for loop ?

A=[2 3; ... 4 7; ... 5 4; ... 2 1]; idx = nchoosek(1:size(A, 1), 2); B = A(idx(:, 1), :) - A(idx(:, ...

ongeveer 4 uur ago | 0

Answered

Save error on linux

Does the folder "/project/XXX/XXX/LTC/ACO/Realistic_ins/" exist? Mounting a folder "/project" directly as root folder is very un...

Save error on linux

Does the folder "/project/XXX/XXX/LTC/ACO/Realistic_ins/" exist? Mounting a folder "/project" directly as root folder is very un...

ongeveer 10 uur ago | 0

Answered

Suppress contourm figure window

The HandleVisibility manages the visibility of the handle for searching with e.g. findall. This does not mean the optical visibi...

Suppress contourm figure window

The HandleVisibility manages the visibility of the handle for searching with e.g. findall. This does not mean the optical visibi...

ongeveer 11 uur ago | 0

Answered

creating a GUI with edit box and push button

Omit the brute clearing header clc;clear all; close all; It is a waste of time, kills other windows, and has not serious benef...

creating a GUI with edit box and push button

Omit the brute clearing header clc;clear all; close all; It is a waste of time, kills other windows, and has not serious benef...

1 dag ago | 0

Answered

Errors while reading binary data files

The problem is hidden here: fid = fopen(file, 'rt'); This opens the file in "text"-mode on Windows. Then e.g. a CHAR(8) is con...

Errors while reading binary data files

The problem is hidden here: fid = fopen(file, 'rt'); This opens the file in "text"-mode on Windows. Then e.g. a CHAR(8) is con...

1 dag ago | 1

| accepted

Answered

How to draw a rectangle over a patch?

You can draw into different AXES objects, while the top one is invisible: FigH = figure; Axes1H = axes(FigH, 'XLim', [0, 100...

How to draw a rectangle over a patch?

You can draw into different AXES objects, while the top one is invisible: FigH = figure; Axes1H = axes(FigH, 'XLim', [0, 100...

1 dag ago | 0

| accepted

Answered

Dot indexing is not supported for variables of this type.

Replace: strfind(sorted_cell_array_of_folder_names(i).name,'.'); % by strfind(sorted_cell_array_of_folder_names{i},'.'); The...

Dot indexing is not supported for variables of this type.

Replace: strfind(sorted_cell_array_of_folder_names(i).name,'.'); % by strfind(sorted_cell_array_of_folder_names{i},'.'); The...

1 dag ago | 0

| accepted

Answered

When is output assigned from function?

Your first version is fine. When the function myfun() exists, the contents of A is replied as first output. The value of B is no...

When is output assigned from function?

Your first version is fine. When the function myfun() exists, the contents of A is replied as first output. The value of B is no...

1 dag ago | 0

Answered

how to make it into for loop

iPeak = 0; % [EDITED] for k = [0, 3, 6, 9] name = sprintf('%d.txt', k); data = load(name, '-ascii'); iPeak = iPeak +...

how to make it into for loop

iPeak = 0; % [EDITED] for k = [0, 3, 6, 9] name = sprintf('%d.txt', k); data = load(name, '-ascii'); iPeak = iPeak +...

1 dag ago | 0

| accepted

Answered

Different results for formula in Matlab and Excel

It looks, like you have a typo in the code you have typed in Excel.

Different results for formula in Matlab and Excel

It looks, like you have a typo in the code you have typed in Excel.

1 dag ago | 0

Answered

How to save multiple figures with specific figure name in a certain directory ?

Ah, I see: print([destination,num2str(base),'-dpng','-r2000']); % ^ End of file...

How to save multiple figures with specific figure name in a certain directory ?

Ah, I see: print([destination,num2str(base),'-dpng','-r2000']); % ^ End of file...

1 dag ago | 0

| accepted

Answered

How to go about programming this function in MatLab

function c = YourSum(x, y, a, b) c = sum(sqrt((a - x).^2 + (b - y).^2)); end

How to go about programming this function in MatLab

function c = YourSum(x, y, a, b) c = sum(sqrt((a - x).^2 + (b - y).^2)); end

2 dagen ago | 0

Answered

How do I fit a damped sine wave to my data?

x = csvread('PH 1140 - 3R (1,1) - Sheet1.csv'); y = csvread('PH 1140 - 3R (1,2) - Sheet1.csv'); plot(x, y); hold on; This is...

How do I fit a damped sine wave to my data?

x = csvread('PH 1140 - 3R (1,1) - Sheet1.csv'); y = csvread('PH 1140 - 3R (1,2) - Sheet1.csv'); plot(x, y); hold on; This is...

2 dagen ago | 2

| accepted

Answered

Error: Matrix dimensions must agree

Seriously? Your code contains some jokes: -1/.5 == 2 kron(eye(32), [-2, 0; 1, 0]) .* ones(64, 1) == kron(eye(32), [-2, 0; 1, 0...

Error: Matrix dimensions must agree

Seriously? Your code contains some jokes: -1/.5 == 2 kron(eye(32), [-2, 0; 1, 0]) .* ones(64, 1) == kron(eye(32), [-2, 0; 1, 0...

2 dagen ago | 0

Answered

Finding the index of duplicate rows in a cell

A = [3,8; 8,9; 8,9; 3,9; 3,9; 3,5; 5,10; 5,10; 3,10; 3,17; 3,17; 11,17; 10,11; 10,11; 3,10]; B = {[3,8;8,9;9,3]; [3,5;5,10;3,10...

Finding the index of duplicate rows in a cell

A = [3,8; 8,9; 8,9; 3,9; 3,9; 3,5; 5,10; 5,10; 3,10; 3,17; 3,17; 11,17; 10,11; 10,11; 3,10]; B = {[3,8;8,9;9,3]; [3,5;5,10;3,10...

2 dagen ago | 0

| accepted

Answered

Cernter of gravity.

I assume you mean the center of mass. A matrix is an rectangular set of numbers. So should we assume, that the values of the mat...

Cernter of gravity.

I assume you mean the center of mass. A matrix is an rectangular set of numbers. So should we assume, that the values of the mat...

2 dagen ago | 0

Answered

Array indices must be positive integers or logical values.

The error message means, that in F(i), the i has its default value, which is the imagninary unit. As Weixin Wang has mentioned ...

Array indices must be positive integers or logical values.

The error message means, that in F(i), the i has its default value, which is the imagninary unit. As Weixin Wang has mentioned ...

2 dagen ago | 1

| accepted

Answered

How to find the row and column for a value within a matrix [c] nearest or equal to 700.

find(inputMat (closest(700))) This is pure guessing. Notice that a command like closest(X) cannot even work in theory, because ...

How to find the row and column for a value within a matrix [c] nearest or equal to 700.

find(inputMat (closest(700))) This is pure guessing. Notice that a command like closest(X) cannot even work in theory, because ...

2 dagen ago | 1

Answered

Not Enough Input Arguments

"when you click the Run button in the future" - This means, that you tried to run the programn pressing the green triangle, the ...

Not Enough Input Arguments

"when you click the Run button in the future" - This means, that you tried to run the programn pressing the green triangle, the ...

5 dagen ago | 0

Answered

How can I build my own randi function from scratch?

What exactly is "from scratch"? Which tools are included, which one are excluded? E.g. where do you want to take your random bit...

How can I build my own randi function from scratch?

What exactly is "from scratch"? Which tools are included, which one are excluded? E.g. where do you want to take your random bit...

5 dagen ago | 0

Answered

How would I perform logical comparisons with times given in the form of a string vector?

Are you sure that this is working: temptime = IE322data{:,3}; What is the contents of IE322data ? The command works only, if t...

How would I perform logical comparisons with times given in the form of a string vector?

Are you sure that this is working: temptime = IE322data{:,3}; What is the contents of IE322data ? The command works only, if t...

5 dagen ago | 0

Answered

Separate correctly values in array

A = [7.046, 15.66, 24.16, 31.476, 39.42, 62.86, 69.83, 91.326, 98.586,106.672, 114.722]; B = [0.53, 1.25, 2.01, 2.78, 3.51, 4.2...

Separate correctly values in array

A = [7.046, 15.66, 24.16, 31.476, 39.42, 62.86, 69.83, 91.326, 98.586,106.672, 114.722]; B = [0.53, 1.25, 2.01, 2.78, 3.51, 4.2...

5 dagen ago | 0

| accepted

Answered

How to get a license?

Ask the admin of your university to contact Matlab's sales team. You find the contact address on the web site.

How to get a license?

Ask the admin of your university to contact Matlab's sales team. You find the contact address on the web site.

6 dagen ago | 1

Answered

Print variable in new window

This is a smart tool to create text windows: https://www.mathworks.com/matlabcentral/fileexchange/8641-jprintf

Print variable in new window

This is a smart tool to create text windows: https://www.mathworks.com/matlabcentral/fileexchange/8641-jprintf

6 dagen ago | 0

Answered

Need help with a While loop: Summation

You need this line: summedValue = summedValue + i; There is no need to call this function recursively, so omit the line Summa...

Need help with a While loop: Summation

You need this line: summedValue = summedValue + i; There is no need to call this function recursively, so omit the line Summa...

6 dagen ago | 0

Answered

How to use linspace on a matrix

A = [0.8112, 0.8861, 0.8112, 0.8861; ... 1, 1, 1, 1; ... 1, 1, 1, 1; ... 1, ...

How to use linspace on a matrix

A = [0.8112, 0.8861, 0.8112, 0.8861; ... 1, 1, 1, 1; ... 1, 1, 1, 1; ... 1, ...

6 dagen ago | 0

| accepted

Answered

saving image file using imread

The message tells you, that you image has unexpected dimensions. JPG and PNG accept 2D matrices and [M x N x 3] RGB arrays. The ...

saving image file using imread

The message tells you, that you image has unexpected dimensions. JPG and PNG accept 2D matrices and [M x N x 3] RGB arrays. The ...

7 dagen ago | 0

Answered

my graph looks weird

Maybe you want to remove the markers? stem(f,angle(X)*57.3,'linewidth',0.5, 'Marker', 'none'); If you want something else, exp...

my graph looks weird

Maybe you want to remove the markers? stem(f,angle(X)*57.3,'linewidth',0.5, 'Marker', 'none'); If you want something else, exp...

7 dagen ago | 0

| accepted