답변 있음
How to create a vector for multiple frames of data in rows and columns?
The actual question is: "I need to create a vector that corresponds to the time of each frame starting at 0" What about: t = l...

3년 초과 전 | 0

답변 있음
How to read a specially structured data file
[fid, msg] = fopen('test.5p'); assert(fid > 0, '%s', msg); C = fscanf(fid, '%g', inf); % Read all in one block fclose(fid); ...

3년 초과 전 | 2

답변 있음
how to reduce the size of array as small as the smallest array to have them in one matrix
There are several possibilities: Fill the shorter arrays with zeros or NaNs on the top, bottom or both. Crop the longer arrays...

3년 초과 전 | 0

답변 있음
How to make a folder, call functions from it, and then go back to the current directory
Changing the current directory is not useful in stable code, neither to process data nor to run Matlab functions. The addpath c...

3년 초과 전 | 1

답변 있음
Why is my function not working?
Avoid using the name of the function as name of the output. This is confusing only. Which is the failing line? In this line f35...

3년 초과 전 | 1

| 수락됨

답변 있음
How to put non repeated elements of a symmetric matrix in a row vector?
You have hidden an index in the name of the variables. This was a bad idea. It is time to re-organize your data. Are all these ...

3년 초과 전 | 1

답변 있음
can we share our original code here,?
The FileExchange is a suiting location for sharing code, while the Answers forum is not. Plagiarism does only occur, if the cop...

3년 초과 전 | 0

답변 있음
how to plot subfigures in one figure like this image?
subplot calls axes with specific 'Position' proerpties inside. You can do this directly also. ax1 = axes('NextPlot', 'add', 'Vi...

3년 초과 전 | 0

| 수락됨

답변 있음
why two function in separate m.file not in one ?
If you need a function inside another one only, you can store it in the same M-file. If other function should have access to the...

3년 초과 전 | 0

답변 있음
Setup alias command in Windows.
As far as I understand, Matlab does not run in the command shell under Windows. Maybe the -batch or -wait flags are useful. See...

3년 초과 전 | 0

| 수락됨

답변 있음
How to create function handle using random output
Maybe: maximand = @(x) f([p_bar, q_bar, r_bar, x(randperm(3, 3))])

3년 초과 전 | 0

답변 있음
use two indexes at the same time in a for loop
for i = 4:5 & k = 1:2 This is pure guessing. While some human can understand, what you want, if you apply such trivks inspo...

3년 초과 전 | 1

답변 있음
How do I add a left/right axis to a plot in matlab 2013a
You find several corresponding FileExchange submissions: https://www.mathworks.com/matlabcentral/fileexchange?q=plotyy plotyy ...

3년 초과 전 | 0

답변 있음
WindowButtonMotionFCN callback slow down the application
Try if rejecting repeated calls solve the delay. See e.g. https://www.mathworks.com/matlabcentral/answers/570829-slow-sizechange...

3년 초과 전 | 0

답변 있음
how to do break the program written in script file and execute
Breakpoints are a good idea: Simply click on the bar on the left side of the editor. You will see a red dot occurring there. Mat...

3년 초과 전 | 0

| 수락됨

답변 있음
Image processing of a binary image
w = 300; % Image size bigR = 140; smallR = 15; wantN = 40; % Number of small circles N = 0; center = zeros(...

3년 초과 전 | 0

| 수락됨

답변 있음
How can I get a variable that starts in t=0?
y(1, 1) = 500; % Set initial value before the loop for t = 1:249 % y(1, :) is defined already, so start at t=1, not t=0 ...

3년 초과 전 | 1

답변 있음
Most practical way to speed up calculations?
I've seen many examples in the forum, where the old and fundamental method of vectorization slows down the execution compared to...

3년 초과 전 | 0

| 수락됨

답변 있음
How to create 4D array of images
Maybe this is enough: List = dir('C:\ParentOf_A_B_C', '**', '*.gif'); Array = []; for k = 1:numel(List) img = imread(fu...

3년 초과 전 | 0

답변 있음
How to perform derivative of a random signal without finite difference schemes?
You can try a Savitzky-Golay-Derivative filtering: https://www.mathworks.com/matlabcentral/fileexchange/30299-savitzky-golay-smo...

3년 초과 전 | 0

답변 있음
fprint f for a matrix
x = [0 3 0; 1 2 3]; c = sprintfc('%g', x.'); c(x.' == 0) = {''}; fprintf('\t%s\t%s\t%s\n', c{:}) % Or: s = compose("%g",...

3년 초과 전 | 0

답변 있음
How can I reuse numerical values them back as inputs?
Working with functions is the way to go. You cannot use Matlab efficiently without functions. But as far as I understand, your ...

3년 초과 전 | 0

답변 있음
Can I access local functions for unit testing
You can call subfunctions only from their main function. This impedes a unit-testing. But the main function can provide a functi...

3년 초과 전 | 0

| 수락됨

답변 있음
why do I receive not enough input arguments
signal_avg_limt "(Dec20-1(cut4&2)_filter, 50, 094167" This calls the function with 1 argument: a string. I guess you mean this ...

3년 초과 전 | 0

답변 있음
Truncate strings to maximum length
Omit arrayfun: str = ["ab", "cdefg"]; extractBefore(str, min(4, str.strlength())+1) If this still looks to clumsy, write your...

3년 초과 전 | 1

답변 있음
How to share relatively large data among GUI callbacks?
50 MB is not a large array in times of Gigabytes of RAM. Sharing an array by guidata does not create deep copies, but Matlab use...

3년 초과 전 | 0

답변 있음
In what way is the new R2021b Editor UI "improved"?
I still miss the editor option existing inMatlab 6.5, which allowed to provide the selected text as input to functions defined b...

3년 초과 전 | 0

답변 있음
Decode a base64 code into a audio file and save it
Look into the output of the base64 decoding. You find these characters on the top: .E...B...B...B...B...B.. webmB...B....

3년 초과 전 | 1

| 수락됨

답변 있음
Sort producing inconsistent results when re-ordering legend
lines = sort(findobj(gca,'type','Line')) This is a bad idea. findobj replies the handles to the line objects. To feed sort with...

3년 초과 전 | 0

답변 있음
How shift output of array
If the transformation should be linear, this is a multiplication: a = [-1, 1] b = a * pi But "[-1 -0.5 0 0.5 1] -----> [-p...

3년 초과 전 | 0

더 보기