Answered
subfunction in script
No, subfunctions in scripts are not allowed. This has been discussed repeatedly. See: * <http://mathworks.com/matlabcentra...

8 years ago | 1

| accepted

Answered
Using ODE45 on inverted pendulum without external torque
Is this stored in one file and you start it using the "Start" button of the editor? Then |invpen| is called without inputs. S...

8 years ago | 1

Answered
Getting the Indices of an Array with conditions
A bold guess: A = [0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 0 ]; Ap = [0, ...

8 years ago | 0

| accepted

Answered
How to extract variable from function file, and how to check is that result real?
[zv,pv,R]=ode45(@fun_z,[1 0],[1; 0; 0; 0]) This is a bold and wrong guess. Why do you assume, that |ode45| replies an arbitr...

8 years ago | 1

| accepted

Answered
how to use mat-lab to filter the input data
See: * <https://www.mathworks.com/help/matlab/ref/filter.html doc filter> * <https://www.mathworks.com/help/signal/ref/filtf...

8 years ago | 0

| accepted

Answered
Why is my GUI program producing an error when i press the acquisition button?
The error message is clear: There is no QString property on the UIControl class. Remove the "Q": measurements=str2nu...

8 years ago | 0

Answered
Is there any changes after writing audio in MatLab?
In other words: S1 = Scrambling('demo.wav', 3, 5, 'dbl'); D1 = Descrambling(S1, 3, 5, 'dbl'); file = fullfile(t...

8 years ago | 0

Answered
Can't activate Matlab on new laptop
You can see a list of activated computers in your profile on the MathWorks pages. Do you find activated licenses there? If so, d...

8 years ago | 0

Answered
How can I get the name of the class object as a string?
This sounds like meta-programming. If the actual program requires information about the implementation of the code, the complexi...

8 years ago | 1

Answered
FiltFilt function initial and final conditions
As written in the documentation, and as you can see inside the code, |filtfilt| mirrors the initial and final values to reduce t...

8 years ago | 0

| accepted

Answered
how to reduce execution time in my code?
~exist('VarName') This is a very bad idea. Remember, that |exist(s)| searches the whole Matlab path for M files, other file...

8 years ago | 1

| accepted

Answered
How can i generate a function using this points?
x = [1,3,8,25,45,23]; y = [25,24,13,69,25,75]; p = polyfit(x, y, 5)

8 years ago | 1

| accepted

Answered
Undefined function for input arguments of type 'char'.
Did you select "Simulink Desktop Real-Time software" during the installation of Matlab and do you have the required license? If ...

8 years ago | 0

Answered
How to turn off GUI settings shwon in Command Window
The shown output is created by set(handles.axes1); See: |help set|: A = set(H) set(H) returns or displays t...

8 years ago | 2

| accepted

Answered
How to get the folder name?
As long a "uigetdir_workaround" is not known, how can we guess, which output you get? Why don't you use |uigetdir|? To split a p...

8 years ago | 0

| accepted

Answered
Is it possible to save partial arrays without compression? matfile() forces compression during save.
What about using a binary file together with |memmapfile|?

8 years ago | 2

| accepted

Answered
Someone helps me to avoid loops. it slows down my calculation. Thank you
This loop is not the problem. It takes a negligible amount of computing time only. Use the profile to find the real bottleneck o...

8 years ago | 0

Answered
Populate Listbox with exceptions
Replace [sorted_names,sorted_index] = sortrows({dir_struct.name}'); by the simpler: sorted_names = sort({dir_struc...

8 years ago | 0

| accepted

Answered
How can I smooth a velocity signal?
There is no general solution. Did you search in the net already? You find thousands of examples, which explain the problem of th...

8 years ago | 0

Answered
Vectorize the assignment operation
a = {[4] [2 3 1] [] []} tC = [1 2 0 0] n = cellfun('prodofsize', a); aa = cat(2, a{:}); C(aa) = repelem(...

8 years ago | 0

| accepted

Answered
settings values of radio buttons in GUI
No, radio buttons have only 2 states by definition: They are either checked or unchecked. It is not clear, what you want to achi...

8 years ago | 0

Answered
how do I save each iteration of a nested FOR loops, in its entirety, to plot max, min and say 4th or 6th highest max value.
You can use a cell array: count = 0; result = cell(1, 121); total = zeros(1, 121); for a = 1:8 X = 2 * a; ...

8 years ago | 0

Answered
Out of memory issue although there is more RAM space than matlab requires
Your matrix |Z| needs a contiguous block of 51 GB RAM. The SVD of a 80447x80287 matrix will create 3 matrices 80447x80447, a 804...

8 years ago | 0

Answered
timeout on input prompt
You can try to use a timer and <https://www.mathworks.com/matlabcentral/fileexchange/28603-inputemu-keyboard-mouse-emulator-v1-0...

8 years ago | 0

| accepted

Answered
THETA1 must return a column vector.
As the error message say clearly: Your function |theta1| is expected to return a column vector. You did not post this function, ...

8 years ago | 0

| accepted

Answered
sorter and faster code
I assume the nested loop is the bottleneck of your code. Use the profile to check this. Remember that it is not useful to improv...

8 years ago | 1

| accepted

Answered
using sliders to scroll up/down the result appears in static text object
Use a 'listbox' instead of a 'text' |uicontrol|, because it has a scroll-bar automatically.

8 years ago | 1

Answered
Error using vertcat Dimensions of arrays being concatenated are not consistent.
I prefer spaces around each operator and keeping the parentheses only, where they improve the readability. Compare: 1.7e-3 ...

8 years ago | 2

| accepted

Answered
How to make long title for a plot with automatic line breaks?
This is a job for the |textwrap| command. Create an |uicontrol('Style', 'text')| at the wanted position and provide its handle t...

8 years ago | 0

Answered
How do I create a random number from a range that includes zero?
For a double with 32 bit used random bits and [0, 1): r = randi([0, 4294967295]) / 4294967296.0 % constants: 2^32-1 and 2^32 ...

8 years ago | 3

| accepted

Load more