# Jan

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.

**Statistics**

RANK**4**

of 242,589

REPUTATION**35,751**

CONTRIBUTIONS

**78** Questions

**13,704** Answers

ANSWER ACCEPTANCE **
79.49%
**

VOTES RECEIVED**8,384**

RANK**71** of 17,000

REPUTATION**11,894**

AVERAGE RATING**4.90**

CONTRIBUTIONS**51** Files

DOWNLOADS **334**

ALL TIME DOWNLOADS**105566**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Runge-Kutta 4th Order

Start with Matlab's onramp: https://www.mathworks.com/learn/tutorials/matlab-onramp.html This is not a tutorial for an RK4 sol...

17 hours ago | 0

Trying to pass a variable name for a file in a for loop to xlsread

pathname = 'C:\Documents\MATLAB\FileName.xlsx'; This is a fixed CHAR vector and does not consider the variable FileName. Steph...

17 hours ago | 0

Unique value for each sequence of two corresponding variables

A = [ 1 1 1 2 2 1 1 1 3 3 2 2 2 3 3 3]; B = [ 7 7 7 9 9 7 7 7 7 7 9 9 9 7 7 7]; [Aa, iA] = unique(A, 'first'); Bb = B(iA); ...

17 hours ago | 0

| accepted

Built-in "filter" function works drastically faster in Matlab than in generated C code

That filter becomes the bottleneck can have two reasons: filter is processed less efficiently in the generated C code. The eff...

3 days ago | 0

MATLAB Hardware Key Licensing

You can install and activate Matlab on an offline machine without any net connection from this computer. You need another comput...

4 days ago | 0

mex error for path names with spaces

Try this: mex('<my script>', '-I"C:\Program Files\MySQL\MySQL Server 8.0\include\"', ... '-L"C:\Program Files\MySQL\MySQL ...

4 days ago | 3

two 3*3 matrix multiplication using for loop in matlab.

If you search in the net or in this forum, you find: https://www.mathworks.com/matlabcentral/answers/154803-how-to-multiply-mat...

4 days ago | 0

Indexing through a cell array

A bold try: day = 1:7; pop = [1,2,3,3,3,4,6]; age_list = cell(1, numel(day)); age_list{1} = 1; % Is this given?! for k = 2...

4 days ago | 0

| accepted

smoothdata function not working for matrix . any one have ideas to what is going on?

It works fine in the current online version: a = rand(20, 22) + (0:21); b = smoothdata(a); plot(a, '--') hold('on'); plot(b...

4 days ago | 0

is an image a 2d grid or a cube

This is a question of taste. It depends on what you want to consider as elements of the array. An image is a 2D object containi...

4 days ago | 1

| accepted

How to use a matrix of 12*12 to form a matrix of 96*96?

gLg = kron(eye(8), Lg) % A small example: X = [1,2; 3,4]; kron(eye(3), X)

5 days ago | 1

PC turned off towards end of Matlab installation and now the program does not appear in uninstall-list

Install it again. The existing files are overwritten and the missing filers are inserted.

5 days ago | 1

Reorganize vector elements without losing neighbor dependencies?

P = [0, 0, 0, 4, 5, 0, 7, 0]; PNorth = [0, 0, 0, 5, 0, 0, 0, 0]; old = [4,5,7]; new = [1,2,3]; LUT(old + 1) = new...

5 days ago | 0

| accepted

find how many times duplicates occur in a matrix across row

As fas as I understand, you want to obtain the indices of the elements of A, which occur once only. Then: index = ~isMultiple(...

6 days ago | 0

I need a function to identify if a number is part of a vector or matrix.

If this is really time critical try https://www.mathworks.com/matlabcentral/fileexchange/26867-anyeq

6 days ago | 1

Printing an embedded newline character in a string using fprintf

mystring = "This is my string.\nIt is too long so I use newline\ncharacters to print on the next line."; fprintf(mystring); Or...

6 days ago | 0

How can I get a cross-platform dbstop statement where a file separator is needed?

Do I understand correctly that you want to run dbstop in @myClass/myFun>mainLoop in Linux and under Windows: dbstop in @myCla...

6 days ago | 0

| accepted

How can I create a set of N diagnal matrices range from diag(1, 1, ... , 1) to diag(-1, -1, ... , -1) for testing purposes?

z = repmat(eye(4), 1, 1, 16); z(z==1) = 1 - rem(floor((0:15) ./ [1; 2; 4; 8]), 2) * 2; % Inlined DEC2BIN Generalized: ...

7 days ago | 0

parfor slower than for

The main work in you example is the iterative growing of the array. This is a waste of time in sequential and parallel code. Pre...

7 days ago | 0

To calculate the mean vector, covariance matrix, and correlation coefficient matrix of a RGB image. I have trouble getting the mean, cannot use the mean for matlab.

What do you expect this line to do: for i = l :length (img(:,:,1)) ? The length() command replies the longer dimension of the ...

7 days ago | 0

large file slow running

I guess that the iterative growing of the array data slows down the processing. Remember that the growing of an array required ...

7 days ago | 0

How to reduce data irregularly?

See: https://www.mathworks.com/matlabcentral/answers/1454924-downsample-data-adapively-intelligently#answer_789429

7 days ago | 0

How to suppress anonymous function handle being created?

As usual the created variable is not shown, if you append a semicolon ; after the command. a = @(x) sin(x) % Output: b = @(y...

8 days ago | 1

Convert a jpg graph into matrix arrays

This is not possible. Saving the data with the low screen resolution to a jpeg removes the possibility to access the data in a h...

8 days ago | 0

removing some the elements in cell array

for k = 1:nunel(data_array) data_array{k} = data_array{k}(4:5); % or = data_array{k}(4:end); % Or: % da...

8 days ago | 1

| accepted

How do I pass a filename to a routine in Matlab's command window?

The error message is clear: The file does not exist. Although you assume, that the current folder is the same, this is not true....

8 days ago | 0

| accepted

How to put uigetfile data from Pushbutton into Listbox?

I'm not sure what you want to achieve. With some guessing: function loadekstrak_Callback(hObject, eventdata, handles) % hObjec...

9 days ago | 0

| accepted

Performance difference between loop and recursion in fibonacci sequence

A cleaner version of your loop uses a pre-allocation of the output: function y = fibor_loop_2(n) y = zeros(1, n); % Pre-alloc...

9 days ago | 1

| accepted

Changing the range of for loop give different result

You cannot create a matrix, whose elements are matrices. This works with a cell array: A = cell(r+1, k+1); for i = 2:r+1 ...

9 days ago | 0

Matlab如何将cell中的矩阵进行合并？

R = {[3;2], [3;5], [4;2], [4;5], [5;2]}; nR = numel(R); f = true(1, nR); for iR = 1:nR if f(iR) ...

9 days ago | 0