Respondida
Remove specific entry in a cell array
animals(ismember(animals,'dog')) = [];

más de 8 años hace | 7

| aceptada

Respondida
5th Order Runge Kutta
E.g., 5th Order Runge-Kutta-Fehlberg coefficients can be found here: <https://en.wikipedia.org/wiki/Runge%25E2%2580%2593Kutta...

más de 8 años hace | 0

| aceptada

Respondida
How to plot different parts of one vector with different colors?
Something like this if you go with the segmented approach: ix = { 1:523, 524:704, 704:numel(time1) }; colors = 'gyr'; ...

más de 8 años hace | 1

| aceptada

Respondida
Coding Practice: When to use a structure rather than separate variables?
I prefer using a single double matrix to store the x-y-z data. E.g. storing each x-y-z triplet as a column, which makes it easie...

más de 8 años hace | 1

Respondida
I am working matrix, but confused on this.
B23 and B14 in MATLAB syntax would be B(2,3) and B(1,4).

más de 8 años hace | 0

Respondida
How to find the value of x for certain y(x)
This can easily be solved by hand x = 5*log((-y+26669/5)/5000)/7;

más de 8 años hace | 0

Respondida
Fixing matrix dimensions to match
Use the element-wise operator .* (with the initial dot) instead of the matrix multiply operator * (without the dot). E.g., ...

más de 8 años hace | 1

| aceptada

Respondida
Matrix Reshape and deleting elements in a matrix
x = original matrix result = reshape(x(1:end-2),19,72);

más de 8 años hace | 1

| aceptada

Respondida
Randomly select samples from a matrix in proper order
Solution without repeats: x = your vector n = number of samples to select y = x(sort(randperm(numel(x),n))); If yo...

más de 8 años hace | 1

Respondida
How to avoid loops for the following matrix manipulcation
Since the A_i are sparse, you are probably stuck with your loop. Consider storing them as A{i} instead of A_i, however, to make ...

más de 8 años hace | 0

Respondida
Is it possible to create a numeric array with a mixture of empty cells and numbers?
Well, you can do it directly pretty much as you typed it: result = [16 22 NaN NaN 2 1 9 19 NaN]; ...

más de 8 años hace | 0

Respondida
I cannot get my function to solve quadratic equations to work. Can anyone help?
Put your function code in a file called Q1_15024248.m somewhere on the MATLAB path (e.g., your working directory).

más de 8 años hace | 0

| aceptada

Respondida
My function output has complex numbers, and I'm not using i or j. Why?
For a discussion on robust methods for calculating the angle between two vectors, see this link: <https://www.mathworks.com/m...

más de 8 años hace | 0

Respondida
Determine whether a specific array element is already included in the large array
A brute force way: tf = any(all(arr == arr_temp,2)); Or, for older versions of MATLAB: tf = any(all(bsxfun(eq,arr,a...

más de 8 años hace | 0

Respondida
I want to understand the meaning(Syntax) of this line. Someone please explaiin what conditions are being used and what does it exactly mean in terms of variables used
The result of fmag<=1 is a logical variable. The expression fth(fmag<=1) picks of those elements of fth that are at the locatio...

más de 8 años hace | 1

| aceptada

Respondida
Does anyone know what is the input argument in line 3 mean?
You probably pushed the green triangle "run" button in the editor, or you entered "myiftest" at the command line without giving ...

más de 8 años hace | 0

Respondida
Using flipud Function?
Try this: R = R(end:-1:1,:,:);

más de 8 años hace | 0

Respondida
How to approximate cosine with taylor series expansion and while loops
Taylor series for cos(x) is 1 - x^2/2! + x^4/4! - x^6/6! + ... So, you are missing that first term of 1 and your x expon...

más de 8 años hace | 0

| aceptada

Respondida
How to get the result of Plus A1, A2, A3, A4, ..., A(i) using a loop?
The best answer is to *not* create variables with these names in the first place, because as you are finding out they are hard t...

más de 8 años hace | 1

Respondida
How can I xor a and b now?
Using the fact that XOR is basically a "not equals" operator for bits: a = your first converted binary string b = your s...

más de 8 años hace | 0

| aceptada

Respondida
How to randomly generate two integers for N number of times?
E.g., for n samples walk = 2*(rand(1,n)>0.5) - 1;

más de 8 años hace | 1

| aceptada

Respondida
count number of ones in binary matrix
Assuming you mean the sum of all elements: A = your matrix; result = sum(A(:)); If you really mean just the edges or ...

más de 8 años hace | 0

Respondida
I would like to use implied loop for reshape, but got the error message.
For isen you have 1:tn as one of the index ranges ... don't know if that is a typo or if it should have been 1:zn. (Or maybe the...

más de 8 años hace | 0

| aceptada

Respondida
How to compare values in two vectors and modify a new vector based on that results?
If Azd1 and Azd2 are vectors, then Azd = Azd2; x = (t1>=t2); Azd(x) = Azd1(x); If Azd1 and Azd2 are scalars, then ...

más de 8 años hace | 1

| aceptada

Pregunta


Intuitive numeric value for indicating ':' and 'end'
I am working on a mex routine that will accept indexing vectors. I would like this vector to be able to use the equivalent of ':...

más de 8 años hace | 1 respuesta | 0

1

respuesta

Respondida
multiply scalar with struct regarding
Well, just this: s.f = rand(3); % a matrix in a struct field x = rand; % a scalar result = x * s.f; % multiply a s...

más de 8 años hace | 1

Respondida
C consists of 258*1258 double with NaN in it.How can I replace all NaNs with blank entries and store as a same format 258*1258 doublet?
It is not clear what the entries of C actually are. Looks like a cell array from your {[]} syntax, but you mention an apparent ...

más de 8 años hace | 0

| aceptada

Respondida
how to search through cell array of char vectors
Type the following at the command line: dbstop if error Then run your code. When the error occurs, the code will pause a...

más de 8 años hace | 0

| aceptada

Respondida
Always getting 255 while adding.
All of the integer types clip resulting values at both ends. So for uint8 it clips the lower end at 0 and the upper end at 255. ...

más de 8 años hace | 0

| aceptada

Cargar más