Answered
Plotting a spiral in MATLAB knowing the start and end points and number of turns?
This does the job (for an integer number of turns) % given values pos = [8 4 ; % startpoint 2 7 ] ; % endpoint ...

7 years ago | 5

| accepted

Answered
why '==' is not working properly, or what do I do wrong?
There is a small difference, as shown by subtraction: b(100)-a(5) To tolerate such a small difference between x and y, try thi...

7 years ago | 2

Answered
a problem while using an anonymous function
You do not show the whole error message! But I also assume that the problem is indeed in the use of factorial inside the func...

7 years ago | 0

Answered
Error: Dot indexing is not supported for variables of this type when initializing an array
As described in the comments, this produces the same error: A = {} ; % cell A{1}.x = 1:10 % -> error! % Unable to per...

7 years ago | 0

Answered
how to extract the string from the struct array
I think you have a so-called struct array. Try: PSM(1).name

7 years ago | 0

Answered
Why do the decimals disappear when I put the values into an array?
You have somehow initialised the array _value_ as a *uint64*. When you add a row, this new row is hence converted to uint64 as w...

7 years ago | 0

Answered
I am Having Cell element 1X2, of 8 bit each i want it to make as individual element 1x16???
Your variable d is a *cell array of strings*. Here is a simple trick to concatenate the cells ( _using comma-separated list expa...

7 years ago | 1

| accepted

Answered
How to make precision and recall of same length?
You want to do some kind of interpolation, for instance, using: r12_adjusted = 0.1:0.1:1.0 % take care (##) p1_adjusted...

7 years ago | 0

Answered
Matrix manipulation Specific rows and columns
First you need to read in the excel into a regular matlab array. Then use logical indexing to select your data. An example: ...

7 years ago | 0

Answered
combining cell arrarys to one cell
I think you want to concatenate the n cells into a simple n-by-4 array, like this C = {[1 2 3 4],[2 3 4 5],[4 3 2 1]} % n=3...

7 years ago | 1

| accepted

Answered
How to sort rows of a cell array by date/time when the other columns are different data types?
I assume your date time are stored in strings. Here is a simple approach % some data C = {'A' datestr(now) 1 11 ; 'B' d...

7 years ago | 0

| accepted

Answered
Trying to split a Matrix into two matrices dependant on the value of row elements.
You reduce the size of A in the loop! Here is the matlab way to go, split in multiple lines, so you can follow its logic: ...

7 years ago | 0

| accepted

Answered
Matrix Manipulations - How to achieve these specific forms?
Bruno's and KSSV's answers do not create the matrices you asked for, or am I mistaken? Anyways, here are my suggestions: ...

7 years ago | 2

| accepted

Answered
Hello, I am new to Matlab and want help to count number of rows in a matrix that belong to data subset.
Let A be your matrix, as above. I suggest you study the outcome of each step below: tf1 = isnan(A) tf2 = all(tf1,2) i...

7 years ago | 0

| accepted

Answered
sortrows problem, i can't run my code file
This replicates when the input to sortrows is not what you think it is. A = [3 ; 1 ; 2] % 1 column only sortrows(A, 2) ...

7 years ago | 0

Answered
could anyone help me to find the first number in the row
<</matlabcentral/answers/uploaded_files/128473/Untitled.png>> It took me some time but I've found it for you :-)

7 years ago | 1

Answered
How to plot a heatmap of a table where the rows represent y position and columns the x position using the data as the heat variable.
Version 2017a introduced the function *heatmap*. See the documentation: <https://uk.mathworks.com/help/matlab/ref/heatmap.htm...

7 years ago | 0

| accepted

Answered
reshape matrix without loop
A simple one-liner would do, I think, letting accumarray do all the work: A = [ 1 1 5 1 2 6 ...

7 years ago | 2

| accepted

Answered
Is there a way to create such type of "block diagonal' matrix without loop?
A = [ 1 2 3 ; 4 5 6 ] B = arrayfun(@(k) sparse([2 3 3],[1 2 3],A(k,[1 1 2])),1:size(A,1),'un',0) B = cat(1,B{:}...

7 years ago | 0

Answered
Plotting lines are broken, can anyone help me out how to fix this issue? It is related to Graphics but my graphics drivers are upto date.
Using the double dashes in the plot command does create a broken line. Use a single dash to create a solid line: x = 1:10 ;...

7 years ago | 1

| accepted

Answered
how to convert cell array to a matrix?
A = {[1 2 3],[4 5],6 ; [11 12],13,[] ; 21, [22 23], [24 25]} % data B = arrayfun(@(k) cat(2,A{k,:}),1:size(A,1),'un',0) ...

7 years ago | 0

Question


is there a way to get the values associated with the *minor* tick marks?
_get(gca, 'xticks')_ only returns the major tick marks ... Thanks! ~ Jos

7 years ago | 1 answer | 0

1

answer

Answered
randomization of a vector by blocks
C = repmat(1:13,1,2) % conditions per block % [block1 block2] rC = [C(randperm(numel(C))) C(randperm(numel(C)))] % *corr...

7 years ago | 0

| accepted

Answered
hi, I have 2 columns data, In that every 1 column data of 1000 value (like 1.2345). i have split this data into (1 to 30), (1 to 60),so on (1 to 990).
Here is a way: data = randi(10,20,1) % some data (20 points, rather than 1000, so easy to check) n = 4:4:numel(data) ...

7 years ago | 0

| accepted

Answered
NaN/Inf/Complex value warning using "fit"
Your model is ill-suited to this set of data, as you can verify by checking the output of data_fit. When you provide a proper st...

7 years ago | 0

Answered
NaN and Inf error when using "fit"
Are you really sure? Set a breakpoint in line 47 of your function MyCode, and check the values you enter into *fit* ...

7 years ago | 0

Answered
Sampling from an image file without replacement
% select 70 random indices without replacement between 1 and numImages imIDX = randperm(numImages, 70) ; for K = imI...

7 years ago | 0

Answered
create multiple arrays or matrix from function input
Here is an example. I suggest you store the result in a cell array where each cell can hold a vector with a different length ...

7 years ago | 0

Submitted


randomwalk
Create a random walk in any number of dimensions

8 years ago | 3 downloads |

0.0 / 5
Thumbnail

Answered
How to create a random walk in 1d array
Let N be the number of steps into the random walk in X dimensions, this is a one-liner that produces the positions: N = 50...

8 years ago | 1

Load more