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

error in processing multiple images in a loop code
I assume this was meant: [~, filename, ~] = fileparts(filenames); % ^^^^^ instead of fileinfo

etwa 14 Stunden ago | 0

Adding a Vector at Certain Points of a Sequence
seq = [1 0 1 0 0 1 1 0 0 1]; signal = [0 0 0 1 2 1 0 0 0 0]; seq = randi([0,1], 1, 1e5); signal = randi([0, 10], 1, 1e2)...

etwa 15 Stunden ago | 0

How to understand and apply arrayfun - getting intuition beyond the documentation.
You can replace arrayfun by a loop: X = [1, 12; 1, 13; 1, 12; 2, 4; 2, 4; 2, 4; 3, 9; 3, 9; 3, 9]; L = X(:,1); M = arrayfun...

etwa 16 Stunden ago | 0

Save plots in a for cycle
If you want to create every 2nd image only, simply use: for i = 1:2:sz(3) % ^^ then i is [1, 3, 5, ...] To save the ...

etwa 18 Stunden ago | 0

| accepted

reduce values on a vector
You are overwriting the variable Surveillance_signal_samples repeatedly: for kk =1:nSurv Surveillance_signal_samples=Surve...

ein Tag ago | 0

How to output a new matrix that swaps the position of the beginning and end of a separate matrix
latitude = zeros(1,18); longitude = zeros(1,43); for i=1:18 latitude(i) = 48+(i-1)*1; end for j=1:43 longitude(j)...

2 Tage ago | 0

Newton to see when the Gradient = 0
In the line: xd=x+d; x is a [2x1] vector and d a [1x2] vector. The implicite expanding replies a [2 x 2] matrix. Maybe this f...

2 Tage ago | 0

How to apply an IIR-Filter correctly on a PCM-Signal?
Yes, this filter reduces the power massively: data = load('handel.mat'); signal = data.y; b = [0.049922035 -0.09...

2 Tage ago | 0

| accepted

Dimensions of arrays being concatenated are not consistent.
The message means, that you cannot concatente arrays horizontally, if they have a different number of rows. Or vertically, if th...

4 Tage ago | 0

Create cell array of handle functions, which have been created from 2x1 double arrays
a = [1; 2]; b = [3; 4]; f = cell(2, 1); for ff = 1:2 f{ff} = str2func(sprintf('@(t) %d * t + %d', a(ff), b(ff))); end f

4 Tage ago | 0

| accepted

changing the legend line style (":","-","--","-.") for 4 black lines in plot instead of using multip colour
figure; axes('NextPlot', 'add', ... 'LineStyleOrder', cellstr([":", "-", "--", "-."]), ... 'ColorOrder', zeros(1, 3))...

5 Tage ago | 0

Finding Sequences of 1's values
Some timings of the methods provided in this thread: x = randi([0, 1], 1, 80000); format long g disp(timeit(@() Jos(x))) d...

7 Tage ago | 0

unix/system comand Always print out some environment setting when using it
% Without semicolon: system('pwd') % With semicolon: system('pwd'); % With semicolon and catching outputs: [status, out] = ...

7 Tage ago | 0

Is there a reason why row vectors are default in Matlab?
Matlab was developped as "Matrix Laboratory". So the default type is a double matrix. If the focus has been set to vectors, it w...

8 Tage ago | 0

Translate file name in mapped drive to unc path filename
No, there is no Matlab command to perform this automatically. net use sovles this and WMIC can help also: [status, out] = syst...

8 Tage ago | 0

How to efficiently allocate memory using a parfor loop
ET = permute(E_mat, [2,3,1]); Q = zeros(size(ET)); parfor n = 1:size(E_mat, 3) Q(:,:,n) = sigmaE(n) / 2 / mass_density(n...

8 Tage ago | 1

| accepted

exportgraphics does not save at specific location
The folder is existing but Matlab cannot create a file in it. Then Matlab does not have write permissions in this folder. filea...

8 Tage ago | 0

merge many mat files in one big vector
Why do you overwrite the first part of PSD_Monat in each iteration? for k=1 PSD_Monat([1:k*f1],1)=d(:,1) %d([1:k*f1],1)...

9 Tage ago | 0

Is it possible to run Matlab Deep Learning Toolbox functions in Octave?
No. For 2 reasons: It is not 100% compatible (I'm sure!). The license conditions will not allow this. If you do have a license...

9 Tage ago | 1

| accepted

Min of each column of a sparse matrix?
For large inputs a loop is faster than accumarray: X = sprand(2000, 20000, 0.2); tic; for k = 1:10 [ii,jj] = find(X); ...

9 Tage ago | 0

simplify my script?
Move all repeated work out of the loops. In your case: % Load data ncfile = 'Temperature.nc'; months = {'January'...

9 Tage ago | 0

generate sine waves that appears after one another
figure; % Insert this: axes('NextPlot', 'add'); % Equivalent to: hold('on') ... Otherwise the plot() command clears it...

9 Tage ago | 0

Function not processing dat for each element in array
Remember, that Matlab's IF condition must be a scalar. If you provide n as a vector, the line: if n >= 50 implicitly perfo...

10 Tage ago | 1

Is there any equivalent keyword 'goto' in matlab not in simulink but in matlab coding
No, there is no GOTO in Matlab and it should be avoided strictly in good code. Maybe: function YourFunc n = 123; % ??? for ...

10 Tage ago | 0

| accepted

Storing output of function file in workspace
Nested nested functions - brrr. What about: t = 0.3:0.1:6; ? You store the variable Cfit in the workspace of the function Pa...

10 Tage ago | 0

Fields names cannot contain the charcater '#' . fld = sprintf('File_%d', i); Data.(fld) = readmatrix(Files2Read{i}); ...

10 Tage ago | 0

| accepted

Need some help with re-formating a text.file using MATLAB?
Actually all you want to do is to replace the string a = sprintf('''10''\n') % by b = sprintf('''10'' good ') and c = sp...

13 Tage ago | 0

how to make timer callback function?
app.something = 'hello'; tt = timer('Name','Test','Period',1, ... 'ExecutionMode','fixedSpacing','BusyMode','drop'); tt.Ti...

13 Tage ago | 0

| accepted