Question

Is there a built-in function to validate a class property that should be a cell array?

I'm new to classes and learning about how to define properties and validate their values. I have a class with a property A that...

10 months ago | 3 answers | 1

Answered

how to display the results from simulink in a table

I also prefer working with tables and csv files rather than mat files so I wrote a script to convert a Simulink SimulationOutput...

how to display the results from simulink in a table

I also prefer working with tables and csv files rather than mat files so I wrote a script to convert a Simulink SimulationOutput...

12 months ago | 0

Question

Simulink vector index assignment / re-ordering using Selector block

I'm trying to merge two vector signals into one vector according to two sets of indices. For example: u_pos = [2 3 4]; du_p...

1 year ago | 1 answer | 0

Answered

Find in a cell array?

Just in case someone comes here looking to do this with a cell array of chars as I was, it's quite easy this way: my_cell_array...

Find in a cell array?

Just in case someone comes here looking to do this with a cell array of chars as I was, it's quite easy this way: my_cell_array...

1 year ago | 3

Answered

How to add a parameter value to the icon of an S-function block

Based on the comments in response to Benjamin's answer, here is the complete and concise answer to the question: First create a...

How to add a parameter value to the icon of an S-function block

Based on the comments in response to Benjamin's answer, here is the complete and concise answer to the question: First create a...

1 year ago | 0

| accepted

Question

How to add a parameter value to the icon of an S-function block

I'm new to S-function blocks in Simulink but I've made a working S-function block and now I want to display a value on its icon....

1 year ago | 2 answers | 0

Question

How to store structs and cell arrays of matrices in an S-function's Dwork memory.

I implemented a sophisticated multi-model process observer in MATLAB code using struct objects for convenience. Each struct has ...

1 year ago | 0 answers | 0

Question

Find the minimums along 3rd dimension of an array

I have a 3d array that is constructed from two 2d arrays: a = [1 2 3; 4 5 6; 7 8 9]; b = [1 2 0; 4 0 9; 9 8 9]; c = cat(3,a,b...

1 year ago | 1 answer | 0

Answered

Set Simulink model simulation stop time from m file

You can also do it by passing it as an argument when you run the simulation from the m file: sim_out = sim(sim_model, t_stop)

Set Simulink model simulation stop time from m file

You can also do it by passing it as an argument when you run the simulation from the m file: sim_out = sim(sim_model, t_stop)

1 year ago | 2

Answered

Check for equality in the contents of two arrays ignoring order

I think this might be the answer for case 1 (A & B are sets): A = [1 3]; B = [3 1]; assert(isempty(setxor(A, B))) A = [1 3]; ...

Check for equality in the contents of two arrays ignoring order

I think this might be the answer for case 1 (A & B are sets): A = [1 3]; B = [3 1]; assert(isempty(setxor(A, B))) A = [1 3]; ...

1 year ago | 0

Question

Check for equality in the contents of two arrays ignoring order

I want to check that the contents of two arrays are equal, ignoring ordering of the elements. I couldn't find an existing answe...

1 year ago | 3 answers | 0

Answered

Importing a Table :: [Variables are been modified by Matlab]

The answer by Steven Lord didn't work for me. I got this error: Error using readtable (line 198) Unknown Parameter 'VariableN...

Importing a Table :: [Variables are been modified by Matlab]

The answer by Steven Lord didn't work for me. I got this error: Error using readtable (line 198) Unknown Parameter 'VariableN...

1 year ago | 0

Answered

How to round numbers in tables?

Is here a way to use the round function with tables? Simply using round(my_table, 3) does not work: t = array2table(randn(3, 4...

How to round numbers in tables?

Is here a way to use the round function with tables? Simply using round(my_table, 3) does not work: t = array2table(randn(3, 4...

1 year ago | 0

Question

Is it possible to sample multiple signals at different rates with the extendedKalmanFilter object?

I need to implement an extended Kalman filter in a MATLAB for loop and decided to use the extendedKalmanFilter object. This was ...

1 year ago | 0 answers | 0

Answered

Efficiently calculate exponentially weighted moving averages of matrix?

I find the easiest way is to use a discrete filter. But the input data is in columns here not rows: x = [0 1 1 1 1; 0 0 1 1 1]...

Efficiently calculate exponentially weighted moving averages of matrix?

I find the easiest way is to use a discrete filter. But the input data is in columns here not rows: x = [0 1 1 1 1; 0 0 1 1 1]...

1 year ago | 0

Question

How to index the values of an array using a series of rows, column indices?

Couldn't find an answer about this and it is not mentioned in the Matlab documentation page on array indexing. I want to know h...

1 year ago | 1 answer | 0

Question

Efficient algorithm to compute only the most probable sequences of a random variable out of all possible sequences

I'm looking for a better way to compute the possible sequences of a random variable whos value at time k is given by. x(k) = 1 ...

2 years ago | 3 answers | 1

Question

Waterfall plot not showing correctly

I think this is an undesirable feature of the waterfall plot function and I'm posting it here so that others don't spend as long...

2 years ago | 0 answers | 0

Question

Special characters in m-file comments are being removed/replaced

I've noticed that special charactes such as 'Γ' and '│' that I sometimes use in comments in m-files are being removed: % Comput...

2 years ago | 0 answers | 0

Answered

How to add variable names for each column when using array2table

I wrote a function to do it: function T = array2table_with_name(X, label, sep) % T = array2table_with_name(X, label) converts ...

How to add variable names for each column when using array2table

I wrote a function to do it: function T = array2table_with_name(X, label, sep) % T = array2table_with_name(X, label) converts ...

2 years ago | 0

Question

Best way to generate an array of all possible integer numbers for a given base and number of digits

I want to prepare an array that contains all combinations in rows of possible sequences represented by an d-digit number of base...

2 years ago | 1 answer | 0

Answered

CRL:"Simulation Target IPP BLAS" cannot be found in the registry

Problem was solved for me on Mac OS X by closing MATLAB and all Simulink files and restarting.

CRL:"Simulation Target IPP BLAS" cannot be found in the registry

Problem was solved for me on Mac OS X by closing MATLAB and all Simulink files and restarting.

2 years ago | 1

Answered

How to construct a cell array containing a power series of a matrix

Here is a solution using cellfun: results = cellfun(@(i) A^i, num2cell(1:n), 'UniformOutput', false)

How to construct a cell array containing a power series of a matrix

Here is a solution using cellfun: results = cellfun(@(i) A^i, num2cell(1:n), 'UniformOutput', false)

2 years ago | 0

Question

How to construct a cell array containing a power series of a matrix

I want to compute the following power series of a square matrix A (as a preliminary step to constructing a larger matrix using t...

2 years ago | 1 answer | 0

Answered

Bypassing the internal (Linear) observer in MPC toolbox 3

Might be 10 years too late but I had this question and it looks like you can set the following check box below in the Simulink M...

Bypassing the internal (Linear) observer in MPC toolbox 3

Might be 10 years too late but I had this question and it looks like you can set the following check box below in the Simulink M...

2 years ago | 0

Answered

How to deal with Extended Kalman Filter in Simulink when my state transition function is given in continuous time form?

Check out the examples in the documentation here: https://www.mathworks.com/help/control/ref/extendedkalmanfilter.html The exa...

How to deal with Extended Kalman Filter in Simulink when my state transition function is given in continuous time form?

Check out the examples in the documentation here: https://www.mathworks.com/help/control/ref/extendedkalmanfilter.html The exa...

2 years ago | 0

Answered

Simulink: There is no solver registered as 14.

I don't know exactly what caused this error but I found I could run the msfcn_limintm.m example from the S-functions in the docu...

Simulink: There is no solver registered as 14.

I don't know exactly what caused this error but I found I could run the msfcn_limintm.m example from the S-functions in the docu...

2 years ago | 0

Answered

How are structs handled when passed to a function?

Seems that MATLAB makes a complete copy of a struct when it is passed to a function if any element is changed by the function (s...

How are structs handled when passed to a function?

Seems that MATLAB makes a complete copy of a struct when it is passed to a function if any element is changed by the function (s...

2 years ago | 0

Question

Unable to detect datetime or duration data using readtimetable with a seconds index

Here is a toy example of my problem: % Create a timetable with a seconds index data = timetable(seconds(1:3)', randn(3,1), ran...

2 years ago | 1 answer | 2

Answered

Find the First element that satisfies a condition

If you only want to find the locations in A where the condition is true and then index those values you can use find: >> elemen...

Find the First element that satisfies a condition

If you only want to find the locations in A where the condition is true and then index those values you can use find: >> elemen...

2 years ago | 1