Community Profile

photo

Jan


Last seen: Today
12,734 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.

Jan's Badges

  • Personal Best Downloads Level 4
  • Editor's Pick
  • First Review
  • 5-Star Galaxy Level 5
  • First Submission
  • Grand Master
  • Revival Level 4
  • 36 Month Streak
  • Thankful Level 4
  • Knowledgeable Level 4
  • First Answer
  • Promoter
  • Commenter
  • Solver

View details...

Contributions in
View by

Answered
how to create a matrix from a vector in this style
P = [0.9, 0.8]; n = 4; m = n*n + n; Q = zeros(n, n + 1); Q( 1:1+n:m) = P(1); Q(n+1:1+n:m) = P(2); or: Q = reshape(repmat...

10 hours ago | 0

Answered
inputemu function works continuously
I guess, that you mean: https://www.mathworks.com/matlabcentral/fileexchange/28603-inputemu-keyboard-mouse-emulator-v1-0-1 Perh...

10 hours ago | 0

Answered
How to pass additional variables with serial callback function (R2020b)
What about an anonymous function_ configureCallback(s, "terminator", @{src, evt} mycallback(src, evt, handles)) The ugly solut...

11 hours ago | 0

Answered
handles.axis not working: cant set an image
Remember that the values of handles is fixed at the time, this callback has been defined. So if the fields "pleasewait" and "i1"...

11 hours ago | 0

Answered
mat2str() on complex values with 0 inaginary part
Mathematically 5 is the same as 5+0i, so the output is correct. So omitting the imaginary part is a question of taste. If you ...

11 hours ago | 0

| accepted

Answered
Opening word documents that are password protected in "read-only mode": how to close the pop-up window from Matlab
I cannot try it currently by my own: wdoc = word.Documents.Open([pwd '\' title], [], 'true'); Does something like this work? S...

11 hours ago | 1

| accepted

Answered
ODE OutputFcn returning fewer points than expected
The code looks okay. Check again if tspan has really 1001 time points. Use the debugger to check, what's going on. Set a breakp...

12 hours ago | 0

Answered
Get only the digits in the first 2 characters of a string
filename1 = '13_data_rec_233'; filename2 = '1_data_rec_124'; num1 = sscanf(filename1, '%d', 1) num2 = sscanf(filename2, '%d...

12 hours ago | 1

| accepted

Answered
Adjust measurement data with different vector lengths using interpolation
n1 = length(Vector_1); n2 = length(Vector_2); n3 = length(Vector_3); nMax = max([n1, n2, n3]); IP_Vector_1 = interp1(1:n1,...

13 hours ago | 0

| accepted

Answered
Fix the function hlp
By the way, this can be done in one line: arr = reshape(1:n^2, n, n).' .^ ((1:n) .^ rem(0:n-1, 2)) Have fun with analyzing, ho...

18 hours ago | 0

Answered
Batch scheduler or pick up the run after wall time expires or checkpoints
DataFile = 'C:\Temp\YourData.mat'; if isfile(DataFile) Data = load(DataFile); else Data.i0 = 1; Data.j0 = 1; e...

19 hours ago | 0

Answered
Is there a limit to the number of elements in an array in Matlab
Check again, if you are really reading the file your expect you do. Use absolute path names to control this. If the file starts...

22 hours ago | 0

| accepted

Answered
Number to String Conversion Inaccuracy
Matlab uses the default type double, which is defined by the IEEE 754 standard. This type is implemented in the CPU hardware als...

1 day ago | 1

Answered
How to move files to one level up and append the name of the folder in which they are contained?
BaseFolder = 'myFolder'; FileList = dir(fullfile(BaseFolder, '**', '*.vtp')); for iFile = 1:numel(FileList) File = F...

3 days ago | 0

Answered
MatLab multiple functions question
The instructions ask for: "The output argument should be a Boolean variable". Your function IsLeapYear does not reply anything y...

3 days ago | 0

| accepted

Answered
Array inside an array
The elements of a matrix cannot be a matrix again. But you can insert the elements, such that the array grows: x = 1:3; y = 7:...

3 days ago | 0

Answered
loop: stop if value repeats
N = Number; G = Guess; x = 1:N; R = nan(1, N); found = N; for k = 1:N R(k) = mod(G^x(k), N); if any(R(1:k-1) == R(...

3 days ago | 1

| accepted

Answered
How do I make my for-loop control the signs (+/-) of two variables ("x1hat" and "x2hat") for each loop?
A simplification: if (x1hat(n) >= 0) == (x2hat(n) >= 0) ... else ... end Avoid unnneded square brackets or parenth...

5 days ago | 2

Answered
Axes OuterPosition going nuts
When do you get these output position values? Before a drawnow or afterwards? Please check again, if you are really checking th...

5 days ago | 0

Answered
2D logical indexing of 1D array for resulting 2D array
A = {'A'; 'B'; 'C'}; ind = logical([1, 1; 0 0; 0 1]); indD = double(ind) .* (1:numel(A)).'; % Auto-expand, >= R2...

5 days ago | 1

| accepted

Answered
how do u make a new value that is the sum of two columns
A = [1 2 ;3 4; 5 6 ;7 8; 9 10; 11 12; 13 14; 15 16]; B = A * [0.6; 0.4]

5 days ago | 0

Answered
How can do this?
n = []; while 1 x = input('Enter a positive number: ') if x < 0 % or <= ? break; end n = [n, x];...

5 days ago | 0

| accepted

Answered
Out of memory issue
What is freq0? For j=2 the time span is: T = [0 200000] / 1 % This is [0, 2e5] In [t,y]=ode45(@(t,y)driven_fre(t,y,tau,De...

5 days ago | 1

Answered
Saving data of command window from callback function
function data = displayCharacteristicData(src,~, Flush) persistent Store if isempty(Store) Store = struct('v1', [], 'v2',...

5 days ago | 0

Answered
extract from structure data with a field with the same value
match = strcmp({A.type}, 'type1'); % Logical indices idx = find(match) % Indices value = [A(match).par1] ...

5 days ago | 0

| accepted

Answered
why didn't the event function detect the events?
Just my standard interjection: Matlab's ODE integrators are designed to integrate smooth functions. Your function Tq_Tj() conati...

6 days ago | 0

Answered
Low pass filter VS high pass filter
On first view you see, thet the high frequencies are removed: the changes between neighboring values are reduced. This means tha...

6 days ago | 1

Answered
Maximum number of repeated values over an array
With FileExchange: RunLength : a = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, ... 5,0,0,0,0,0,0,0,0,0,0,0,...

7 days ago | 0

Answered
How can i count how many time a number appears and for how long in a vector?
Start with a run-length-encoding, e.g. by FileExchange: RunLength . If you do not have a C-Compiler installed, use RunLength_M o...

7 days ago | 0

| accepted

Answered
Assembling two matrices into one in a given pattern
A bold guess (although a wrong guess might be more confusing than posting nothing): A = [1 2; 1 2]; B = [2 3; 2 3]; [s1, s2...

7 days ago | 0

Load more