Answered
Nested structs and objects - do or don't?
Off the top of my head I'd probably use a three tier approach, something along the lines of the following untested code: classd...

5 years ago | 0

Answered
resampling to avoid limit - nchoosek
Assuming VID1 has 429 elements and Hcombos has 36 rows, that means you're trying to generate one of this many combinations: N =...

5 years ago | 0

| accepted

Answered
how to define a variable with dates
Adapt the example on this documentation page. It won't require a lot of modification.

5 years ago | 0

| accepted

Answered
Feature Matching in MATLAB
Break each of those steps into sub-steps. Repeat step 1 until you've broken each step into sub-steps that you are able to imple...

5 years ago | 0

| accepted

Answered
Hi, I want to write a code that locates the nth value of matrix x= [2,4,6,8,10,12,14,16,18,20] where n is [1:10]. How could I write that?
That's basic linear indexing. See the "Indexing with a Single Index" section on this documentation page for more information. x...

5 years ago | 0

Answered
Inconsistency of angle function in finding angle of vectors
Typing the command angle(1+i) yields an angle of 45 degrees, No it doesn't. It returns the equivalent angle in radians, however...

5 years ago | 0

Answered
Comparative Operator result is wrong
Two numbers that are displayed the same may not represent the same stored value. See this Answers post for more information abou...

5 years ago | 0

Answered
How to clear a TestCase class from memory?
You may find this new feature introduced in release R2021a useful.

5 years ago | 1

Answered
How to get mean of all variables in a table?
The varfun function requires one of its inputs to be a table or timetable array (or a tall table or timetable.) which -all varf...

5 years ago | 1

| accepted

Answered
Graphplot nodes How to ensure generating only existing nodes.
S=[1 30]; T=[2, 1]; D1 = digraph(S, T) % use S and T as node numbers, 30 nodes plot(D1) D2 = digraph(string(S), string(T))...

5 years ago | 0

| accepted

Answered
Error using inlineeval (line 14)
Do not use inline. We first marked it "not recommended" somewhere between 15 and 20 years ago if I recall correctly. Just opera...

5 years ago | 1

| accepted

Answered
"Array indicies must be positive integers" error
The first element / row / column / etc. of an array in MATLAB is element / row / column / etc. 1. There is no element / row / c...

5 years ago | 0

Answered
Why I can't use keywords "AutoFitWidth" for writematrix() in MATLAB R2020a?
That functionality was added in release R2020b.

5 years ago | 0

Answered
How can I fix this error?
Where in your code do you define a variable named i? If the answer is some form of "nowhere" or "I don't" then MATLAB will call ...

5 years ago | 0

Answered
Modifying variables in properties (TestParameter) of the unittest class
You can define a class-related function at the end of the file, after the end that matches the classdef keyword, that returns th...

5 years ago | 0

Answered
Object oriented programming - Constructor behavior
Because class constructors are special. MATLAB knows exactly which method in a class is the class constructor (it has to have th...

5 years ago | 0

| accepted

Answered
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
function plottransect(1) As stated on this documentation page "If your function accepts any inputs, enclose their names in pare...

5 years ago | 0

Answered
random number generator rng performs differently on compiled binaries (in Linux)
In your application, does the user call your function with the seed value that you pass into rng? x1 = myfun(42) x2 = myfun(99...

5 years ago | 0

Answered
Need assistance in fitting tool
"2pi" is not a valid way to write 2 in MATLAB. y = 2*pi

5 years ago | 0

Answered
Betweenness Centrality for a vertices in an adjacency matrix
Since this question was asked we have added the graph and digraph objects to MATLAB. Use one of those functions to create an obj...

5 years ago | 1

Answered
How to quote variables whose names are in order in a for loop?
See if some of the tools in MATLAB for working with data that is too large to fit in memory on one machine all at once will sati...

5 years ago | 0

Answered
How to add set/get methods methods in class constructor
If prop1, prop2, prop3, etc. are properties in this Registry object that you want to expose as properties of the ExampleClass cl...

5 years ago | 0

Answered
How do I print probability distribution object into textbox?
Since you're using release R2021a you can use the new formattedDisplayText function. x = randn(1e6, 1); pd = fitdist(x,'Normal...

5 years ago | 0

Answered
Extracting table from data structure
At first, I have loaded data using S = dir('*.mat'); The dir function does not load data. All it does is generate a list of fil...

5 years ago | 0

Answered
Repeat user input and output
Defining variables whose names are sequentially numbered is generally discouraged and is a code smell. I second Walter Roberson...

5 years ago | 0

Answered
eval not working for a range of numbers
There's no need for eval. % known values Crank = 0.10 ; % length in meters AB = 0.20 ; % legnth in meter...

5 years ago | 1

Answered
too many output arguments
You likely have a settings function that is taking precedence over the settings function. To confirm this, run the following co...

5 years ago | 0

Answered
can I generate a set of indexed matrices
Can you create a series of variables x1, x2, x3, ... ? Yes. Should you create a series of variables x1, x2, x3, ... ? The gener...

5 years ago | 0

Answered
Element change in a matrix
Take a look at the discretize function.

5 years ago | 0

Answered
~ operator in while not working as intended
Let's take a simpler example. check = @(x) (x ~= 1) | (x ~= 2) Does this return true for 1.5? check(1.5) Does it return true...

5 years ago | 0

Load more