답변 있음
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...

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 1

답변 있음
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, ...

3년 초과 전 | 0

| 수락됨

답변 있음
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...

3년 초과 전 | 1

| 수락됨

답변 있음
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...

3년 초과 전 | 1

| 수락됨

답변 있음
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 ...

3년 초과 전 | 1

| 수락됨

답변 있음
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...

3년 초과 전 | 0

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 1

| 수락됨

답변 있음
Opening multiple instances of MATLAB causes endless folder access errors
What about allowing Matlab to access your documents folder?

3년 초과 전 | 0

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 1

| 수락됨

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 0

| 수락됨

답변 있음
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년 초과 전 | 1

| 수락됨

답변 있음
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년 초과 전 | 1

답변 있음
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년 초과 전 | 1

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 1

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 0

| 수락됨

답변 있음
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년 초과 전 | 0

| 수락됨

답변 있음
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년 초과 전 | 1

답변 있음
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년 초과 전 | 0

답변 있음
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년 초과 전 | 0

| 수락됨

답변 있음
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년 초과 전 | 0

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

3년 초과 전 | 0

| 수락됨

더 보기