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

más de 7 años hace | 5

| aceptada

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

más de 7 años hace | 2

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

más de 7 años hace | 0

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

más de 7 años hace | 0

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

más de 7 años hace | 0

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

más de 7 años hace | 0

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 0

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

más de 7 años hace | 0

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 2

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

Respondida
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 :-)

más de 7 años hace | 1

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 2

| aceptada

Respondida
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{:}...

más de 7 años hace | 0

Respondida
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 ;...

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 0

Pregunta


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

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

1

respuesta

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

| aceptada

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

más de 7 años hace | 0

Respondida
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* ...

más de 7 años hace | 0

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

casi 8 años hace | 0

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

casi 8 años hace | 0

Enviada


randomwalk
Create a random walk in any number of dimensions

casi 8 años hace | 3 descargas |

0.0 / 5
Thumbnail

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

casi 8 años hace | 1

Cargar más