Solved

Get the length of a given vector

Given a vector x, the output y should equal the length of x.

2 months ago

Solved

Select every other element of a vector

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

2 months ago

Solved

Find the sum of all the numbers of the input vector

Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

2 months ago

Answered

How to trasform from cell to matrix and transpose from horizontal to vertical at the same time?

Just change your cat dimension to 1, then transpose later. Data.my_cell = {rand(1,101);rand(1,101);rand(1,101)} m = cat(1,Data...

How to trasform from cell to matrix and transpose from horizontal to vertical at the same time?

Just change your cat dimension to 1, then transpose later. Data.my_cell = {rand(1,101);rand(1,101);rand(1,101)} m = cat(1,Data...

2 months ago | 1

Answered

Can I change my UIFigure size while maintaining location of elements in figure?

I think you may be able to achieve what you want using the uigridlayout, see if this example works on 2019b (I'm on 2022a). The...

Can I change my UIFigure size while maintaining location of elements in figure?

I think you may be able to achieve what you want using the uigridlayout, see if this example works on 2019b (I'm on 2022a). The...

2 months ago | 0

| accepted

Answered

Heatmap is too Thin in Figure

imshow() asserts 1:1 aspect ratio to show the image, so you can manually change the axes Position property after setting DataAsp...

Heatmap is too Thin in Figure

imshow() asserts 1:1 aspect ratio to show the image, so you can manually change the axes Position property after setting DataAsp...

2 months ago | 0

Answered

Implementing Crank Nicholson in spherical setting

I believe this should be the right formulation for CN (taking a few liberties interpreting your problem). If you want speed, pr...

Implementing Crank Nicholson in spherical setting

I believe this should be the right formulation for CN (taking a few liberties interpreting your problem). If you want speed, pr...

8 months ago | 1

Answered

Implementing Crank Nicholson in spherical setting

For one thing, your boundary conditions (as developed on your pdf) don't look right. At r=0, you can just directly use Eq 8 LHS...

Implementing Crank Nicholson in spherical setting

For one thing, your boundary conditions (as developed on your pdf) don't look right. At r=0, you can just directly use Eq 8 LHS...

8 months ago | 0

Question

Built in look-up style interpolation of timetables for non-numeric data?

Is there no built-in function similar to interp1 for numeric data, that can operate on timetables with arbitrary data types? So...

9 months ago | 1 answer | 0

Answered

For loop to carry value down depending on another matrix value

In your example, there is a "delay" by 1 row when your switch from 0 to -1 occurs, so the following answer is not exactly produc...

For loop to carry value down depending on another matrix value

In your example, there is a "delay" by 1 row when your switch from 0 to -1 occurs, so the following answer is not exactly produc...

9 months ago | 0

| accepted

Answered

There used to be a function RefineMesh in Matlab used in solving ODE's, but it is now used for PDE's and isn't the same function. Is there a new function for the old purpose?

The workflow above only re-evaluates the "static" solution of ode45 at more data points by an interpolation scheme consistent wi...

There used to be a function RefineMesh in Matlab used in solving ODE's, but it is now used for PDE's and isn't the same function. Is there a new function for the old purpose?

The workflow above only re-evaluates the "static" solution of ode45 at more data points by an interpolation scheme consistent wi...

1 year ago | 0

Answered

Is there a way to measure interletter spacing for Fixed Width font in MATLAB?

I have no idea what you mean by "visual angle per font size", but I know of one way: lbl = uicontrol("Style","text","String","...

Is there a way to measure interletter spacing for Fixed Width font in MATLAB?

I have no idea what you mean by "visual angle per font size", but I know of one way: lbl = uicontrol("Style","text","String","...

1 year ago | 0

Answered

Functional programming construct to expand cell array into arguments for other functions without using an intermediate variable in the (user) code?

I am still not sure why you can't just have your generalized comparator function saved as a function somewhere on your path so y...

Functional programming construct to expand cell array into arguments for other functions without using an intermediate variable in the (user) code?

I am still not sure why you can't just have your generalized comparator function saved as a function somewhere on your path so y...

1 year ago | 1

Answered

How to integrate uidatepicker command with GUI interface?

Details are thin here...but it sounds like you need to first specify the parent graphics object that you want your uidatepicker ...

How to integrate uidatepicker command with GUI interface?

Details are thin here...but it sounds like you need to first specify the parent graphics object that you want your uidatepicker ...

1 year ago | 0

Answered

How to solve exponential equation to find unknown constants

data = readtable("Book1.xlsx"); Alternatively, based on my reparameterization above you can as a first pass say everything afte...

How to solve exponential equation to find unknown constants

data = readtable("Book1.xlsx"); Alternatively, based on my reparameterization above you can as a first pass say everything afte...

1 year ago | 0

| accepted

Answered

How to solve exponential equation to find unknown constants

Do you have an intuition of what the graph of looks like? Hint: it looks like your plot, scaled and shifted roughly only in the...

How to solve exponential equation to find unknown constants

Do you have an intuition of what the graph of looks like? Hint: it looks like your plot, scaled and shifted roughly only in the...

1 year ago | 0

Answered

Print vectorized graphic of patches without edges

I now believe it is because you are technically plotting 3D patches (telling Matlab there's a z-coordinate, even if they are all...

Print vectorized graphic of patches without edges

I now believe it is because you are technically plotting 3D patches (telling Matlab there's a z-coordinate, even if they are all...

1 year ago | 1

Answered

Calculations of Angle between two points

If you have the list of 3D coordinates rng(1) % control random generator NPoints = 5 vertices = rand(NPoints,3) You can defi...

Calculations of Angle between two points

If you have the list of 3D coordinates rng(1) % control random generator NPoints = 5 vertices = rand(NPoints,3) You can defi...

1 year ago | 0

Answered

How to symbolically integrate f(T) = exp (E/(8.314*T) through integration by parts or with trapezoidal method?

The application still is unclear to me... If you just want numerical integration, look at the function "integral", as implement...

How to symbolically integrate f(T) = exp (E/(8.314*T) through integration by parts or with trapezoidal method?

The application still is unclear to me... If you just want numerical integration, look at the function "integral", as implement...

1 year ago | 0

Answered

Remove zoom from axes

This should be a good entrypoint: https://www.mathworks.com/help/matlab/ref/disabledefaultinteractivity.html https://www.mathw...

Remove zoom from axes

This should be a good entrypoint: https://www.mathworks.com/help/matlab/ref/disabledefaultinteractivity.html https://www.mathw...

1 year ago | 0

Answered

Can I pass arguments to a @callbackFcn?

configureCallback(s,"terminator",@(src,evnt)readSerialData(src,evnt,operation mode)) So the first parentheses specify the inter...

Can I pass arguments to a @callbackFcn?

configureCallback(s,"terminator",@(src,evnt)readSerialData(src,evnt,operation mode)) So the first parentheses specify the inter...

1 year ago | 2

| accepted

Answered

I am trying to find the exact distance of a curvy line.

Assuming that the boundary points are ordered well (adjacently), then you can calculate the cummulative square distance between ...

I am trying to find the exact distance of a curvy line.

Assuming that the boundary points are ordered well (adjacently), then you can calculate the cummulative square distance between ...

1 year ago | 0

Answered

Take only some values from one array

you can't compare arrays of different lengths. a straightforward but cumbersome way is to cycle through each of your t1 and find...

Take only some values from one array

you can't compare arrays of different lengths. a straightforward but cumbersome way is to cycle through each of your t1 and find...

1 year ago | 0

Answered

MATLAB GUIDE to App migration question

Apparently it should work: https://www.mathworks.com/help/matlab/creating_guis/compatibility-between-different-releases-of-app-...

MATLAB GUIDE to App migration question

Apparently it should work: https://www.mathworks.com/help/matlab/creating_guis/compatibility-between-different-releases-of-app-...

1 year ago | 0

| accepted

Answered

How to Save new data to existing structure data in a for loop without having to save the complete Matlab file from Zero?

I would consider using a database, a lightweight solution could be sqlite. I use the third party mksqlite for this purpose and i...

How to Save new data to existing structure data in a for loop without having to save the complete Matlab file from Zero?

I would consider using a database, a lightweight solution could be sqlite. I use the third party mksqlite for this purpose and i...

1 year ago | 0

Answered

using varfun on a timetable with subscripts?

first of all, your operation looks like a "diff", no subscripts (for rows, i.e., timestamps) necessary second, you will be defi...

using varfun on a timetable with subscripts?

first of all, your operation looks like a "diff", no subscripts (for rows, i.e., timestamps) necessary second, you will be defi...

1 year ago | 0

| accepted

Answered

How can I quickly obtain the inverse of a square sparse matrix?

potentially, if you have more information about the properties of A, you can specify them in a call to linsolve https://www.mat...

How can I quickly obtain the inverse of a square sparse matrix?

potentially, if you have more information about the properties of A, you can specify them in a call to linsolve https://www.mat...

1 year ago | 0

| accepted