Answered
How to rename a lot of mfiles in a folder
Let's look at a simple example of what's in the temporary directory. D = dir(tempdir) What's the first file (or "file") in tha...

3 years ago | 0

Answered
can someone give me an example of what a "vector composed of characters" looks like exactly?
A = 'orange' A is a vector of type char. It has 1 row and 6 columns. If you're working with multiple pieces of text data and y...

3 years ago | 0

Answered
How do I exit a for loop after logical index is found true in an array?
continue exits the current iteration and proceeds to the next iteration. break exits the loop entirely.

3 years ago | 0

Answered
why my variable value become these sysbols?
When you concatenate together a char vector and a number, MATLAB does not convert the number into its character representation. ...

3 years ago | 0

Answered
Vector in a Matrix 2x2, calculate the length of the vector
If I understand your question correctly I think what you want is the vecnorm function.

3 years ago | 0

Answered
bisection method, iteration does not stop although hand calculation were diffrent
Let's look at your function. syms x f = sqrt(19.62*x); fun = f*tanh(2.5*f/8); fplot(fun) yline(0) It looks like you have a...

3 years ago | 0

Answered
How to do math using datetime objects including years
date_obs = '22:179:18:42:44.610'; j2000date = '2000:001:12:00:00.000'; These don't look like durations, they look like datetim...

3 years ago | 0

Answered
how can we make one axes as children of other axes??
No, axes may not be children of other axes. I'm not sure I understand what your ultimate goal is. If you give more details abou...

3 years ago | 0

Answered
Convert 8x3 char to string sequence (MATLAB)
val = ... ['011' '010' '001' '000' '000' '001' '010' '011']; s = join(string(val), '')

3 years ago | 0

Answered
How to programmatically get the current/local time zone?
Do you want to create a datetime in the current time zone or do you want to know the current time zone? Those are two different ...

3 years ago | 0

| accepted

Answered
ODE45 requires more parameters than it should
That syntax, where you pass additional input arguments after the options structure, is an older syntax that is no longer documen...

3 years ago | 0

Answered
For loop increment value
See the "Decrement Values" example on the documentation page for the for keyword. Though in the case you described, you don't ne...

3 years ago | 0

Answered
Error using solve function
You have two variables in your cost function, y and int_l. Is y symbolic or a fixed value? If symbolic, with respect to which va...

3 years ago | 0

| accepted

Answered
Read text file, identify variables and rewrite some of the variables
I'd probably read this into a table array. A first pass at reading in this file is below. You probably want to customize the imp...

3 years ago | 0

Answered
script for Unit delay block
Use the programmatic model editing tools.

3 years ago | 1

Answered
Error bars with categorical data type
Let's say that your categorical x data contains values apple, banana, and cherry. When the error bars are plotted with errorbar,...

3 years ago | 0

Answered
Change from 2022 to 2021 Plotting Issues
The ability to plot table arrays by passing them as inputs to the plot function was introduced in release R2022a as stated in th...

3 years ago | 1

Answered
Can't find matlab.exe file
The MATLAB Runtime is not the MATLAB you'd use to develop MATLAB code. It is used to run deployed applications created by MATLAB...

3 years ago | 1

| accepted

Answered
Speed up MatlabFunction or use alternatives
Have you tried telling matlabFunction to skip trying to Optimize the code? cd(tempdir) syms a b c d positive syms x s = solv...

3 years ago | 0

Answered
Detecting maximum with threshold
You may want to take a look at the islocalmax function.

3 years ago | 0

| accepted

Answered
matlab function syms slows down simulink model
Generate a MATLAB Function block using matlabFunctionBlock as shown on this documentation page.

3 years ago | 1

| accepted

Answered
left characters of a string
This wasn't an option when the question was originally asked, but the extractBefore function will work for both char vectors and...

3 years ago | 2

Answered
How to solve dot indexing error in matlab reinforcement learning function "sim"?
The documentation page for the sim function in Reinforcement Learning Toolbox states that the env input argument must be a "rein...

3 years ago | 0

Answered
Is it possible to get a time-dependent function as an output of an ODE solver?
Call ode45 with one output argument. Pass that output from ode45 and an array of times into the deval function to evaluate the s...

3 years ago | 0

Answered
can MATLA read very large CSVs (>150GB)?
Use the tools in MATLAB for processing Large Files and Big Data.

3 years ago | 2

Answered
Converting equations to first order system for ODE45
Let's look at your equations and your definition for your state vector. v' + r + phi'' = alpha1 + alpha2 r' + phi'' = alpha1 +...

3 years ago | 2

| accepted

Answered
Another question on eliminating for loops....
Take a look at the ndgrid function.

3 years ago | 0

Answered
Remove array elements but also store the element indices that were not removed
Do you want the indices or the elements that weren't deleted? a = ["a", "b", "c", "d", "e" ,"f"]; u = [1 5]; indToKeep = setd...

3 years ago | 0

| accepted

Answered
I need to group certain hours of a day into day and night categories from my xlsx file in the format "yyyy-MM-dd'T'HH:mm:ss."
Let's look at a sample datetime. t = datetime('now') What time of day does that represent? tod = timeofday(t) Is that time o...

3 years ago | 0

Answered
"\newline" "\mu" "pi", etc. doesn't work as intended on xticklabel of boxplot. It just prints as it is instead of printing a new line or μ or π.
Note that in order for tick labels to be interpreted as TeX or LaTeX the TickLabelInterpreter property needs to be set correctly...

3 years ago | 0

| accepted

Load more