Beantwortet
Accessing each matrix in a cell array of size ~8GB and filter it
A loop is the efficient solution. Simply try it. If you have >= 16 GB of RAM, this array should be processed without problems. ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
the convolution function i wrote doesn't work for the big arrays
Pre-allocation is important, if you work with large arrays. Example: x = []; for k = 1:1e6 x(k) = k; end In each iterat...

mehr als 3 Jahre vor | 0

Beantwortet
Matlab GUI elements disappear on newer version of Matlab
The uibuttongroup hides objects, which have been created before in modern Matlab versions. Set a position of the uibuttongroup'...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Identify lines that have a repetition (unique function)
data = [ 2.3300000e+02 3.5300000e+02 1.4912281e+00 2.3300000e+02 3.5200000e+02 1.4912281e+00 3.5300000e+0...

mehr als 3 Jahre vor | 0

Beantwortet
How Do I Replace Numbers with Alphabets
The solution is trivial: Simply write it down using CHAR vectors (not strings, which are enclosed in double quotes): n = 'ABCDE...

mehr als 3 Jahre vor | 1

Beantwortet
Matlab energy consumption greater than charger?
This is not a problem of Matlab, but your powersupply is too weak. Is it the original one delivered with the laptop? If so, it m...

mehr als 3 Jahre vor | 0

Beantwortet
addPath does not take a vector from genpath
According to the documentation https://www.mathworks.com/help/matlab/ref/matlab.project.project.addpath.html addPath() takes one...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to rotate this 2d matrix with some angle ?
To define a rotation matrix, you need one angle in 2D (rotation around the Z axis) one angle and an axis of rotation in 3D on...

mehr als 3 Jahre vor | 1

Beantwortet
mask a matrix based on values in two arrays
n = 1e4; u = floor(rand(10,1)*100); v = floor(rand(10,1)*100); tic % Original version: [x y] = meshgrid(linspace(0, 100, ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Do not use the for loop to calculate the first number greater than 0 in each line
x = randn(10, 10) y = x.'; % Required for the last step y(y3==1) y1 = y > 0 y2 = cumsum(y1) % Now a row can contain mult...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
fprintf with complex numbers and ordinary arrays
This does not work without a loop. fprintf(' iteration number root estimates\n'); for k = 1:n fprintf('%10.0...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
What is the fastest way to export a large matrix of numbers from MATLAB to Excel (preferably as .xlsx) ?
Simply try it: M = magic(10^3); tic; writematrix(M, 'file1.xlsx'); toc tic; writecell(num2cell(M), 'file2.xlsx'); toc ...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
All is correct but this code gives error?
I guess boldly, that the code fails here: [pop(i,:),fxi(i,1)]=fminsearch(fitnessfun,pop(i,:),options,varargin{:}); ... fxi=fe...

mehr als 3 Jahre vor | 0

Beantwortet
How do I insert a picture into a script?
It depends on how you would like to see the image. It cannot be displayed in the editor, because scripts are M-files and therefo...

mehr als 3 Jahre vor | 0

Beantwortet
Downsampled data exceeds the input data
A linear interpolation avoids output points outside the range of input point. Use interp1 or the modern and faster griddedInterp...

mehr als 3 Jahre vor | 0

Beantwortet
A very fast way to (i) concatenate and (ii) calculate the difference of elements?
a1 = datetime([ '2022-10-27 00:22:50.000' '2022-10-27 05:29:45.000' '2022-10-27 05:32:19.400' '2022-10-27 05:36:...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
Opening multiple instances of MATLAB causes endless folder access errors
What about allowing Matlab to access your documents folder?

mehr als 3 Jahre vor | 0

Beantwortet
title subplots within a for loop
Avoid the overkill of hold on commands. One per subplot is sufficient. What is the purpose of the "ll" here: title(ll,"(m)") ...

mehr als 3 Jahre vor | 0

Beantwortet
Same code taking 15x longer to execute on a faster machine
n = 32000; % 7362497; dE00 = zeros(6, n,"single"); lab_NF = rand(6, 3, 'single'); labDB = rand(n, 3, 'single'); tic fo...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
why does it has to be tedious to produce high quality figures for (academic) publications using MATLAB? (open Discussion)
My trivial answer: This is the nature of "high quality figures". Depending on the journal you are publishing in different proper...

mehr als 3 Jahre vor | 0

Beantwortet
Converting cell to array data with specific string
data = {'[2, 11, 5, 0] '; '[1, 10, 6, 0] '; '[9, 3, 6, 0] '}; value = str2num(sprintf('%s;', data{:})) Internally str2num is ...

mehr als 3 Jahre vor | 0

Beantwortet
How to use nested FOR loop to create a matrix of answers?
thetaL = 3:3:90; VsL = 10:10:60; ... Other constants Result = NaN(numel(thetaL), numel(VsL)); for itheta = 1:numel(thetaL) ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How to merge very close bins in histogram/hiscounts
You can use FileExchange: RunLength to find the longest blocks of missing data: [b, n] = RunLength(x); match = (b == 0 & n > ...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
How to permanently disable warnings in MATLAB editor?
You can disable the MLint warnings directly in the editor with a right click on the concerned command: The disabling can concern...

mehr als 3 Jahre vor | 1

Beantwortet
How do I find slope for large dataset?
The command gradient(x, t) solves this similar to diff(x) ./ diff(t), but with using the 2-sided difference except for the margi...

mehr als 3 Jahre vor | 1

Beantwortet
Error using plot Vectors must be the same length.
[x, y2] = lab_8_method_2(@lab_8, 0.3, [0 1], 0.01); plot(x, y2 ,'r'); hold on; [x, y4] = lab_8_method_4(@lab_8, 0.3, [0 1], ...

mehr als 3 Jahre vor | 0

Beantwortet
Find a number and range of group of the same number
With FileExchange: RunLength : a = [1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 1 1 2 2 1 1 3 3 3 3 3 1 1 1 2 2 2]; [b, n, idx] = RunLength(...

mehr als 3 Jahre vor | 1

Beantwortet
Hi ,I need some help with this PSO optimization code, "not enough input arguments "error message (Main pso used is The yarpiz's).
I'm not sure what you are asking for, but this is simplified version of your function without a loop: function Y1 = costfunctio...

mehr als 3 Jahre vor | 0

Beantwortet
MEX func Error:"requires medical imaging toolbox" in Matlab R2022b
This seems to be an effect of Matlab's method to check, if you have a license for the used functions. This prevents the user fro...

mehr als 3 Jahre vor | 0

Beantwortet
what happens with Matlab running training if my laptop eventually restarts for windows updates?
"I am scared if my laptop gets restarted automatically then I have to start the training all again" - if your code does not save...

mehr als 3 Jahre vor | 0

| akzeptiert

Mehr laden