# 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 243.800

REPUTATION**35.941**

CONTRIBUTIONS

**78** Questions

**13.753** Answers

ANSWER ACCEPTANCE **
79.49%
**

VOTES RECEIVED**8.422**

RANK**71** of 17.054

REPUTATION**11.916**

AVERAGE RATING**4.90**

CONTRIBUTIONS**52** Files

DOWNLOADS **380**

ALL TIME DOWNLOADS**105787**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

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...

alrededor de 19 horas 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...

1 día ago | 0

I didn't know how to find r

a = 6 * 18 * 18 a = 4 * pi * r.^2 r = sqrt(6 * 18 * 18 / (4 * pi))

2 días 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...

3 días 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...

3 días 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...

3 días ago | 0

| accepted

Not enough Input arguments

Stephen hits the point: >>qardlecm This shows, that you call the function without input arguments. Perhaps you start it by cli...

3 días ago | 1

My "plot" has some problems

Did you update the graphic drivers and install all updates of Matlab? Try different graphic modes: opengl software opengl har...

3 días ago | 0

| accepted

Need matrix or vector with 1,0,1,0,1,0.........

Do you now the colon operator already? a = 2; b = 15; a:b a:3:b You can use this to create an index of the values, you want...

4 días ago | 0

Maximizing along n-1 dimensions of an n-dimensional array without a for loop

VV = rand(8, 9, 10); for ii = 1:size(VV,1) Vtemp = squeeze(VV(ii, :, :)); [V(ii), I(ii)] = max(Vtemp(:)); end ...

4 días ago | 0

| accepted

convert BGRA8 image format to RGB format

Do you have the pixels values as UINT8 array already? Then: RGB = BGRA8(:, :, [3, 2, 1])

4 días ago | 1

| accepted

A function that counts the number of zeros in a vector

Beside sum(D == 0) nnz(D) This would be working also, if the elements are 0 or 1 only: numel(D) - sum(D)

4 días ago | 0

matrix array for loop

See the command: size() https://www.mathworks.com/help/matlab/ref/size.html By the way, you find such commands, when you know ...

4 días ago | 0

Reading visual basic code language like matlab?

There is no direct translation from Visual Basic code to Matlab code. The solution is to learn a programming language, if you wa...

4 días ago | 0

Does Matlab initialize random seed at each -batch run?

Yes, exactly as you observe the random number generator is initialized with the same seed. Use rng to get different seeds. See:...

4 días ago | 0

How to maximize the graph area in case of subplots ?

There is a bunch of solution in the FileExchange. Search for "subplot": https://www.mathworks.com/matlabcentral/fileexchange?q=...

4 días ago | 0

Equivalent of numpy.where() value choice parameters

Your code looks almost fine: x = 0:9 y = (0:9) * -0.1 z = zeros(size(x)); z(mod(x, 2) == 0) = x(mod(x,2) == 0); % ...

6 días ago | 0

| accepted

Understanding coding terminology - indexing

"Indexing" means to address an element of an array by using an index. Example: x = [3,1,4] index = 2 x(index) % reply: 1 T...

6 días ago | 0

calculation norm divided by square root of data length

r = [-33.1869365513747 - 7.19942077700726i 9.95754431609273 - 9.07572996519880i 5.11935460162031 - 9.45713125754552i 17.24067494...

6 días ago | 0

| accepted

How to filter out the elevation higher than 0

I do not see, where your filter out elevations greator 0. It is faster to call interp2 with vectors as coordinates. So avoid ca...

6 días ago | 0

| accepted

Alternatives for dir command

addpath \\winfs\data\prod\maprod\arkivering\TAF; Why do you append this folder to Matlab's path? Are the files stored in this f...

6 días ago | 0

| accepted

Multiplication between elements of two different cells

"first 36 row of F will be multiplied by the first row of T and next 36 row of F will be multiplied by second row of T and conti...

7 días ago | 0

| accepted

How to solve error "merge_sort: failed to get memory buffer"

This sounds like your memory is exhausted. Are you running out of RAM?

7 días ago | 0

| accepted

Dynamically change .txt file name in MATLAB, COMSOL simulation

fname = sprintf('Results_E_Field_Iter%d.csv', iter); file = fullfile('/Users/marissawhitby/Desktop/C:\Users\jmw\Desktop\Output...

9 días ago | 1

| accepted

repeat vector elements and operate on them

Start with a simple loop: A = [12; 10; 5]; B = [4; 3; 2]; RepSum(A, B) function C = RepSum(A, B) len = sum(B); C = zer...

10 días ago | 2

Will this computer run Matlab?

Yes, of course. This is a powerful computer. It depends, on what you want to compute. If a model does not match into the RAM, m...

10 días ago | 0

| accepted

Publishing an mfile including the calls to other m files.

Does this help: https://www.mathworks.com/matlabcentral/fileexchange/33476-publish-dependent-and-called-functions ?

10 días ago | 0

I can`t solwe gauss elimination method

I've simplified the code and converted it from Octave to Matlab: A = [ -3 6 -1 -2; -3 3 -3 1; -1.5 4.5 -2.5 -0.5; 0 1.5 -0.5 -3...

10 días ago | 0

| accepted

Arrays have incompatible sizes for this operation.

Use the debugger to identify the problem. Type this in the command window: dbstop if error and run the code again. When Matlab...

10 días ago | 0

| accepted

How its possible do define this function in Matlab?

Your funcion is almost correct. Just change && to & and consider the logical index time in the output. The problem in your case...

10 días ago | 1

| accepted