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

8 years ago | 0

Answered
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;

8 years ago | 0

Answered
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., ...

8 years ago | 1

| accepted

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

8 years ago | 1

| accepted

Answered
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...

8 years ago | 1

Answered
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 ...

8 years ago | 0

Answered
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]; ...

8 years ago | 0

Answered
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).

8 years ago | 0

| accepted

Answered
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...

8 years ago | 0

Answered
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...

8 years ago | 0

Answered
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...

8 years ago | 1

| accepted

Answered
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 ...

8 years ago | 0

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

8 years ago | 0

Answered
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...

8 years ago | 0

| accepted

Answered
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...

8 years ago | 1

Answered
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...

8 years ago | 0

| accepted

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

8 years ago | 1

| accepted

Answered
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 ...

8 years ago | 0

Answered
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...

8 years ago | 0

| accepted

Answered
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 ...

8 years ago | 1

| accepted

Question


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 ':...

8 years ago | 1 answer | 0

1

answer

Answered
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...

8 years ago | 1

Answered
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 ...

8 years ago | 0

| accepted

Answered
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...

8 years ago | 0

| accepted

Answered
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. ...

8 years ago | 0

| accepted

Answered
Can anyone help to creat this vector ?
You're close, but you need to handle the W(i)=V(i) differently. The way you have it currently coded, this line is overwriting al...

8 years ago | 0

| accepted

Answered
Polynomial fit from the equation
You appear to have both x and time meaning the same thing, and y and data meaning the same thing. Maybe it is just a variable na...

8 years ago | 0

Answered
how to return column index in matrix
x = your original matrix [~,idx] = min(x,[],2);

8 years ago | 2

| accepted

Answered
what's the second variable in size function do ?
The second argument to the size function designates the particular dimension that you want. E.g., in your example, f is a 1x4. T...

8 years ago | 28

| accepted

Load more