Answered
A class to simulate missing arguments in function calls
So you want your function to be able to accept 0, 1, 2, 3, or 4 input arguments? In that case you probably want varargin. funct...

10 days ago | 0

Answered
Writing function for fliping vectors
Your function fails to satisfy the requirements of your question in several ways. Let's look at the first two sentences. Wr...

10 days ago | 1

Answered
How create a list of like this A{1}, A{2}, A{3}, A{4},... etc.?
If you already have a cell array A, use: A{:} to create a comma-separated list from A. If you're trying to create the cell ar...

11 days ago | 0

Answered
managing two variables in sum function
Use element-wise operations to create a matrix of data to sum then call sum with a dimension input. [c, r] = meshgrid(1:5, 1:6)...

11 days ago | 0

Answered
what is coder.gpu.kernelfun;
This function was introduced in release R2017b in GPU Coder. You've indicated in the Release information on this question that y...

11 days ago | 1

| accepted

Answered
Compute the difference matix between a marix and another matrix in MATLAB
You can eliminate one of your loops using the vecnorm function. >> vecnorm(A-B(1, :), 2, 2).^2 ans = 4 25 85

11 days ago | 0

Answered
help me ...cos and sin value not correct ! whay
Line 1 is completely unnecessary, since line 2 overwrites those symbolic variables with numeric values. I'm assuming your trotx...

11 days ago | 1

| accepted

Answered
increasing values midway of an array for theta (using atan2();)
Remember is that atan2 returns values in the closed interval [-pi, pi] so if you go from a y that is just barely positive to one...

11 days ago | 0

Answered
When will Matlab 2020a officially be released?
Most likely "in the March timeframe" as stated on this page.

11 days ago | 0

Answered
Script Skips a portion of code
If length(Daily) is less than 4, the result of the expression 4:length(Daily) will be empty and so the body of that loop will no...

11 days ago | 0

| accepted

Answered
How do I combine data from seperate tables into one table with seperate columns
Consider converting these table arrays into timetable arrays. If you do you can synchronize them all to a common time basis. See...

12 days ago | 0

Answered
str2num results
From the documentation page for str2num: "In addition, str2num uses the eval function, which can cause unintended side effects w...

12 days ago | 0

Answered
Array Indexing in a for loop
Part 1: when one of the quantities you're multiplying is a scalar, the * and .* operators are equivalent. x = magic(4) y1 = 2*...

12 days ago | 1

| accepted

Answered
deep learning tool box
Prior to being renamed in release R2018b Deep Learning Toolbox was known as Neural Network Toolbox. To forestall one question I...

12 days ago | 0

| accepted

Answered
Change for loop stepsize
Rather than computing the elements yourself by repeated multiplication consider looping over a vector created using the logspace...

12 days ago | 0

Answered
Data loading in MATLAB
Loading the data could be as simple as calling load. The more challenging part is likely to be sharing this data among the vario...

13 days ago | 0

Answered
Slicing variable in parfor loop (restricted indexing)
What requirements must a variable satisfy to be a sliced variable? The documentation states four conditions: Type of First-Leve...

14 days ago | 2

Answered
Detecting values in a vector that are different but very close to each other
Use uniquetol to unique-ify the data with a tolerance. uniquetol can return a vector of indices that indicate to which of the un...

14 days ago | 0

| accepted

Answered
Can I check if factored and expanded polynomial forms are equal?
>> syms w k >> x1 = (w^2-k^2); >> x2 = (w+k)*(w-k); >> isAlways(x1 == x2) ans = logical 1

16 days ago | 0

Answered
Only one function doesn't work only after the app designer program is compiled
syms phi z0 This requires Symbolic Math Toolbox which is an ineligible product for MATLAB Compiler. Depending on what "some ...

16 days ago | 0

Answered
Put nested structure into another structure
Why not go directly to a table array? a = maketable("result1", 23, "mph"); b = maketable(["result1"; "result2"], [23; 34], ["m...

16 days ago | 0

| accepted

Answered
I have a complex number z = 5+3j, how do I find the phase of z, complex conjugate of z, and modulus of z?
See the documentation page on Complex Numbers for functions that may be of use when working with complex numbers in MATLAB. Reg...

17 days ago | 0

| accepted

Answered
Produce a diagnistic once per failed test method?
If you want to store your data, why not use a FileArtifact diagnostic? You could put it in a temporary folder created by a Tempo...

17 days ago | 0

Answered
How to call a function if unit test fails?
If all you want your function to do is display a diagnostic message, just modify your call to assert slightly. %% Unit test a ...

18 days ago | 1

Answered
Generating a weighted random number
Set up a vector of probabilities. dist = [2 1 1 1 1 1]; p = normalize(dist, 'norm', 1); % sum(abs(p)) is effectively 1 Use th...

18 days ago | 2

Answered
How to detect the 'end' directive in subsref?
Overload the end method for your class as described on this documentation page. The reason end was always taking the value 1 is...

18 days ago | 2

| accepted

Answered
Matlab and IDL Data Types
The default data type in MATLAB is double. There are some functions and functionality that by default create variables of diffe...

18 days ago | 0

Answered
Random but equal distribution of numbers 1 and 2
Do you need exactly equal numbers of 1's and 2's or just a vector where each element has an equal probability of being 1 or 2? ...

18 days ago | 2

| accepted

Answered
What type of function Matlab has help to construct symmetric matrix?
Several of the matrices you can create using the gallery function are symmetric, and some have other interesting and/or useful p...

18 days ago | 1

| accepted

Answered
Removing columns from a 5x5 matriz
Indexing. The end keyword will also be of interest to you.

19 days ago | 0

| accepted

Load more