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

3 years ago | 0

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

3 years ago | 0

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

3 years ago | 1

| accepted

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

3 years ago | 0

Answered
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)") ...

3 years ago | 0

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

3 years ago | 1

| accepted

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

3 years ago | 0

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

3 years ago | 0

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

3 years ago | 0

| accepted

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

3 years ago | 1

| accepted

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

3 years ago | 1

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

3 years ago | 1

Answered
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], ...

3 years ago | 0

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

3 years ago | 1

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

3 years ago | 0

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

3 years ago | 0

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

3 years ago | 0

| accepted

Answered
Why " The boundary condition function BCFUN should return a column vector of length 5" error message is came?
You provide an extra parameter: solinit = bvpinit(linspace(0,1),[0;3;1;1],2); % ^ here...

3 years ago | 0

| accepted

Answered
Table column of strings to a matrix.
A = ["[0 0 0 0 0 0 0 0]";"[0 0 0 0 0 0 0 0]";"[0 0 0 0 0 0 0 0]";"[1 1 1 1 1 1 1 1]"]; AC = char(A); AC(ismember(AC, '[] ')) =...

3 years ago | 1

Answered
note able to run this program
function [Y,Xf,Af] = myNeuralNetworkFunction(X,~,~) This means, that the 2nd and 3rd input are ignored. But you cannot call thi...

3 years ago | 0

Answered
How can I make a feature in a GUI that my user can drag around?
You find some examples for defining and moving sprites in the FileExchange: https://www.mathworks.com/matlabcentral/fileexchang...

3 years ago | 0

| accepted

Answered
readlines function returns an empty string array
My first idea concerns the relative path: lines = readlines("myfile.dataset", "EmptyLineRule", "skip") Is the current folder r...

3 years ago | 0

Answered
Combine matrixes with like same values
bbox = {[0,241,637,168]; ... [204,181,382,286]; ... [56,314,185,243]; ... [0,59,574,506]; ... ...

3 years ago | 0

| accepted

Answered
asking about the error in my code
The error message tells, that this object does not accept 4 inputs. See also the corresponding documentation. What is the purpo...

3 years ago | 0

Answered
Why can't I put unassigned variables in a 2 x 1 matrix?
You cannot use not existing variables on the right side of an assigment in Matlab. I cannot imagine what you want to achieve wit...

3 years ago | 0

Answered
replacing all occurrences of a string in a file using regexp
Is it required to use regexp? If not: C = readlines(FileName); m = startsWith(C, "VariableProp('" + VarName + ", 'UD', '', ");...

3 years ago | 1

| accepted

Answered
How can I run the datasample function 500 times and record each output within a cell array?
Result = zeros([size(EMG), 500]); for k = 1:500 Result(:, :, k) = datasample(EMG,size(EMG,1)); end

3 years ago | 0

| accepted

Answered
I keep getting an error that the rows and columns must be of power 2. Am confused
Most likely this is the failing command: [cratio,bpp] = wcompress('c',X,'wpeppers.wtc','spiht','maxloop',16); If so, please re...

3 years ago | 1

| accepted

Answered
Set elements to hide\visible MATLAB Guide)
The action should be done inside the callback function, which is called, when the element is clicked: function baseHeightRbtn_C...

3 years ago | 0

| accepted

Answered
Group number identification consecutive numbers
With FileExchange: RunLength : index = [1 0 1 1 1 0 0 0 1 1 1 0 1 1 0 0 1 1]; [b, n] = RunLength(index); m = n(b == ...

3 years ago | 1

| accepted

Load more