Community Profile

photo

Jan


12,209 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

  • 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
Replace value-by-value WITHOUT a loop, from 2 vectors?
X = [1,2,3,4;5,6,7,8;1,4,2,1;6,7,1,2]; a = [1,2,3,4]; b = [100,200,500,400]; [M, ia] = ismember(X, a); X(M) = b(ia(M))

약 1시간 ago | 1

| accepted

Answered
REPEATING COMMAND BY FUNCTION
You should not use GOTO in any code, because it is massively unclear. Use a loop instead: while true p1='Please enter Mini...

1일 ago | 0

| accepted

Answered
I am trying to plot the temperature over time
tVector = 0:time_step:t_final for it = 1:numel(tVector) heat_loss = convection_coefficient*time_step*(T_bottle-T_working);...

1일 ago | 0

Answered
how to set the axes component size to be fixed without to be resize with image size?
It depends on what "width=200" mean. The units matter: Are these data units or pixels? Ax = axes('XLim', [1, 200], 'YLim', [1, ...

1일 ago | 0

Answered
Access to struct atrribute for changing names
Using names like "newMPsOfRun6010_03" shows, that important information is stored in the name of a variable. This is a bad progr...

1일 ago | 1

| accepted

Answered
How can I read a huge json file (0.5GB)
If you use fileread, the 0.5 GB of bytes are converted to a char vector, which occupies 1 GB of RAM, because Matlab uses 2 Byte ...

1일 ago | 0

Answered
Saving data into corresponding arrays of a cell array in cycles
What exactly is the problem? A = cell(N, 3); % Pre-allocate!!! for i=1:N if (a condition) if (Condition 1) ...

1일 ago | 0

Answered
Is there a way to use the RMS function with two options, namely 'omitnan' and an option for the dimension?
There is no documented 'omitnan' argument for rms in current Matlab versions, see: https://www.mathworks.com/help/signal/ref/rms...

2일 ago | 1

| accepted

Answered
String comparison in cell arrays
filt_data = {'PID';'data';'new';'world'}; dat = {'1';'2';'3';'4'}; ma = {'PID';'new';'world'}; match = ismemb...

2일 ago | 0

| accepted

Answered
legend text is transparent in MATLAB R2018a
This has been discussed here already: https://www.mathworks.com/matlabcentral/answers/353013-in-2017a-how-do-i-prevent-a-legend-...

3일 ago | 0

| accepted

Answered
How to select a time from one array which is close to the time in another array ?
Prefer to use modern datetime objects instead of cellstrings containing datestr values: A = [{'05:10:34'} {'05:42:52'} {'06:52:...

7일 ago | 0

| accepted

Answered
How do I pause Matlab execution to wait for file edits
It is a bad idea to edit M-files during the execution. It would be much better to edit a file, which contains the modified param...

7일 ago | 0

Answered
How can I keep just the arrays with 2 is before 3 after random swap 2 numbers.
s = [1,2,3,4,5]; s = s(randperm(numel(s))); % Random permutation? % Or swap 2 elements: index = randperm(numel(s), 2)...

9일 ago | 0

| accepted

Answered
Can you help me to correct this error?
while isempty(A)==0 will not work, because the matrix A does not change its size. I guess you mean: while any(A(:) ~= 0) % Or ...

9일 ago | 0

Answered
How can I loop over a binary image to get 4 equal quadrants always?
Using 4 distinct variables is less convenient than reshaping the array: s = size(q1); q2 = reshape(q1, s(1)/2, 2, s(2)/2, 2);...

9일 ago | 0

Answered
error using imwrite command
The error message is clear: Either the file is existing already and you cannot overwrite it (maybe it is open in another program...

9일 ago | 0

| accepted

Answered
multiply all numbers above a threshold in a matrix by n, but only on certain indices, and keep original matrix dimension
index = (matrix(:, 115) > 0.5); % logical mask matrix(index, 115) = matrix(index, 115) * 100;

11일 ago | 0

| accepted

Answered
please help with this If else statement
Similar to your C++ code, just with some shorter names for variables to reduce the chance for typos: function main toefl1 = in...

11일 ago | 1

| accepted

Answered
Combinations of vectors and matrices
This is faster: function [cn, ci, cc, ca, comb] = MyComb4(n, vn, vi, vc, va) % Get combinations: cn = nchoosek(single(vn), ...

13일 ago | 0

Answered
How to upload 800 csv files that only contains numbers in a cell keeping their names
As I said: The number contain commas as decimal separators. Before such a file can be imported, in much be converted. This costs...

13일 ago | 0

| accepted

Answered
Place text below patch object
Of course text allows to set the background color: axes text(0.5, 0.5, 'Hello', ... 'Color', 'r', 'BackgroundColor', 'c')...

14일 ago | 0

| accepted

Answered
How to loadmat file and run to my code in guide
[fname, fpath] = uigetfile({'*.mat'}, ... 'Select the Vessel Signal file','multiselect','on'); d = load(fullfile(fpath...

15일 ago | 1

| accepted

Answered
speed of loop for calculating group version
This is a very bad idea: temp_g = []; for j = 1:ngroups temp_g = [temp_g ,norm(Beta(groups==j,statsIt) - Beta(groups==j,i)...

15일 ago | 0

Answered
i cant plot the graph
The function needs 3 inputs: function x = logictic1(r, x0, n) You provide 1 inut only: logistics1(1) Then the values of xo a...

15일 ago | 0

Answered
Similarity of two .wav files - unsure about the returned error.
Error using horzcat Dimensions of arrays being concatenated are not consistent. data = [x y]; This means the x and y have a d...

15일 ago | 1

| accepted

Answered
How to find common rows between two cell arrays containing string values?
What about ismember(A, B, 'rows')? I guess your inputs are: A = ["ABC", "DEF"; ... "HTG", "JUKHI"; ... "RTHG", "...

15일 ago | 0

Answered
for loop starting from 1
a = Player{4,1}(:, 1); b = Player{2,1}(:, 2); Output = zeros(length(a)-1, 1); % Pre-allocate Output(1) = sum(b(1:a...

15일 ago | 0

Answered
I need a loop which puts every (j,k) element of every matrix in different columns.
What about: d = cat(3, O{:}); d = permute(d, [3,1,2]) Now you have the wanted columns as first index.

16일 ago | 1

| accepted

Answered
How to make an image take different RGB values?
LUT = randi([0, 255], 256, 3, 'uint8'); % The look up table Img = randi([0, 255], 640, 480, 3, 'uint8'); % The image ...

16일 ago | 1

| accepted

Answered
How to create a loop
e = zeros(1, 14); % Pre-allocate for k = 2:14 e(k) = e(k-1) * (1 + ge) / (1 + y); end

16일 ago | 0

Load more