Community Profile # Jan

Last seen: Today Active 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.

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

why is my vector empty
for i=1:size(A,1) disp(double(A{i})) end i = size(A,1) now. Then: row_=(double(A{i})); Is a vector of the ASCII values o...

etwa 7 Stunden ago | 0

Add a textbox in a subplots inside a loop
Move the repeated code out of the loop to simplify the code: z = [0.44, 4.7, 7, 8, 17.9, 31, 57]; dim = [.2 .5 .3 .3]; c ...

etwa 7 Stunden ago | 0

Why does mldivide solve equations so fast that FORTRAN can't compare it？
Matlab's code for the matrix division is not made public. Internally optimized BLAS libraries and MKL are used. The taskmanager ...

etwa 8 Stunden ago | 0

Converting a binary matrix to decimal.
The error message is clear: bin2dec requires a CHAR vector as input or a cell string. See: doc bin2dec You provide a numerical...

etwa 14 Stunden ago | 1

Error in Bvp4c
You define the variable beta on top of the code, but this does not mean, that it is known in all subfunctions. Pr, gamma and lam...

etwa 14 Stunden ago | 0

How to normalize a matrix in such a wat that every row sum of X(:,:,i) should be 1 except for ith row
X = rand(6, 3, 6); N = sum(X, 2); N(sub2ind(size(N), 1:6, ones(1,6), 1:6)) = 1; Y = X ./ N; Now sum(Y(i, :, j)) is 1 is i~=j...

etwa 14 Stunden ago | 0

Faster for loops/or how to cut some time
a=randn(50,1); b=randn(50,1); tic [aa,bb]=using_cells2(a,b); eloopC=length(aa); eloopP=length(bb); for i=1:(eloopC) ...

ein Tag ago | 0

Get the time of the messages
Try: Time_Matching = Time_AIS1(msg_match{K}) % curly braces

ein Tag ago | 0

find maximum number in a range of data
In max(T(S1,6)) you are searching in the submatrix T(S1, :). But you use the result as index in the full matrix T. You want to a...

ein Tag ago | 0

| accepted

How do i plot equal size of circle in square(100*100 m^2) without overlapping?
This is an extremly challeging task. See https://en.wikipedia.org/wiki/Circle_packing https://en.wikipedia.org/wiki/Circle_pac...

ein Tag ago | 1

cannot calculate mean on for loop
The elements of neg_m are overwritten repeatedly in the inner loop. Maybe you want: for ni = 1:35 neg_m(ni, :) = mean(resh...

3 Tage ago | 0

How to make the negative sign in the legend easier to see?
strcat removes interior spaces. This is not useful here and it is not in general. I consider this as a design error. Use cat in...

3 Tage ago | 0

| accepted

Index exceeds the number of array elements (1)
Replace for j = 1:n-1 by for j = 1:i-1 By the way, you can write s = 0; for j = 1:i - 1 s = s + U(i, j) * x(j); ...

3 Tage ago | 1

| accepted

How can I create three different axis?
See e.g.: https://www.mathworks.com/matlabcentral/fileexchange/67349-plot-with-multiple-y-axes https://www.mathworks.com/matl...

3 Tage ago | 0

| accepted

How to shuffle two matrices in a consistent manner
I assume, X is a matrix and you want to shuffle the rows. Then: X = X(P, :); % ^

3 Tage ago | 1

| accepted

How to get rid of a loop that depends on its previous iterations
Start with calculating the average manually instead of the slower mean() function: % Timings: R2018b, Win10, i7 data0 = rand(1...

4 Tage ago | 0

| accepted

Solving problem with ODE45
In the loop you are calculating the integration from 0 to 2*t(i) with the initial value set to y2(i-1, :). But this is another i...

6 Tage ago | 0

Check for equality in the contents of two arrays ignoring order
unique, setdiff, union and ismember call the function sort also internally. So % assert(isequal(sort(A), sort(B))) Is a very e...

6 Tage ago | 0

How to identify duplicate values in an n dimensional array , then club the linked values related to it in another array
A = [ 1 8 10 4; ... 1 8 4 0]; T = isMultiple(A); B = A(T) % ? or what do you want? A(T) = 0; functi...

7 Tage ago | 0

Iteration Involving 1x4 matrix
while abs(P - Pgiven) > 1e-6 ... end

7 Tage ago | 0

| accepted

Conversion to double from function_handle is not possible.
objective = zeros(1,3); % Here objective is a double for i = 1:Nc % And here you want to store a function handle in the d...

7 Tage ago | 1

Issues running a Mex Function (.mexw64)
The leading "./" means, that it is searching in the current folder. Assuming, that the current folder is chosen as expected, is ...

7 Tage ago | 0

Why doesn't my function for writing a file work?
"Not enough input arguments" might mean, that you call this function without inputs. Therefore the most important part of the co...

9 Tage ago | 0

| accepted

Too many for loops, how to approach rearranging arrays problem differently?
Pre-allocate the output and avoid repeated calculations: a = 1:50; b = 10:50; tic aa = f2(a); bb = f2(b); for i = 1:le...

9 Tage ago | 0

| accepted

I didn't know how to find r
a = 6 * 18 * 18 a = 4 * pi * r.^2 r = sqrt(6 * 18 * 18 / (4 * pi))

9 Tage ago | 0

Estimate the Value of Pi
Your code runs fine and it is clean. It can be simplified, but the application of the index a is valid. I'm not sure why your te...

11 Tage ago | 0

| accepted

Dot indexing is not supported for variables of this type - ISSUE?
Start with experimenting: img2 = reshape(img, [4, 376, 672]); rgb = permute(img2([3 2 1], :, :), [2, 3, 1]); figure, image(r...

11 Tage ago | 0

| accepted

Remez exchange Algorithm for approximation
if a <= M < x(2) if v(end-1)< M <= b if i < M < i+1 These commands will not do, what you want. The comparison is evaluated fr...

11 Tage ago | 0

| accepted