Risposto
compute force matrix from positions matrix
There surely is way to vectorise your code, using bsxfun, accumarray and/or arrayfun, for instance. However, this most likely t...

oltre 10 anni fa | 0

Risposto
i have a code which is written in 2006.the author's name is Xiang Bai .code dose not run. i cant find the problem. so i attached the code and the error message.can anyone help me? i really need help.
This errors arise when the classes of two variables differ. a = uint32(4) b = int8(4) a-b You can try to cast the ...

oltre 10 anni fa | 0

Risposto
Please help! Combine figures into one new figure
Take a look at copyobj figure(1) subplot(1,2,1) ; ph{1} = plot(cumsum(rand(10,20)),'bo') ; figure(2) ax = subp...

oltre 10 anni fa | 1

Risposto
Plot 10 times and take the average
users = [10 20 30 40 50]; N = numel(users) ; rates = zeros(1,N) ; % pre_allocation for i = 1 : N tempV = My...

oltre 10 anni fa | 0

Risposto
Do you have a suggestion for a name of my function?
Thanks all! Nice to see, you all agree that RUN (or boat) should be part of the function name. I'll use runindex as the function...

oltre 10 anni fa | 0

Risposto
array length is not what I've set...
In your code, the variable *j* has two roles: # an index into Hopt # a value that is used for calculation (angle?) Your b...

oltre 10 anni fa | 1

Risposto
Do you have a suggestion for a name of my function?
Thanks for the inspiration! What about *runindex*? Or is this confusing with regard to existing functions?

oltre 10 anni fa | 1

Risposto
what is the fastest way to convert a cell array of delimited numbers into a matrix
A = {'1,5012,0,35,6' ; '2,395,1,35,8'} ; A = repmat(A,250000,1) ; % big array! tic ; A2 = strcat(A,',') ; V = ssca...

oltre 10 anni fa | 4

Domanda


Do you have a suggestion for a name of my function?
I have written a nice little function which I would like to put on the File Exchange. However, I am still looking for a short an...

oltre 10 anni fa | 6 risposte | 2

6

risposte

Risposto
How do I rename fields of a structure array?
You can use DEAL and a for-loop to change fieldnames: % create a structure array, with different fields for k=1:10, ...

oltre 10 anni fa | 1

Risposto
How do I rename fields of a structure array?
There is a somewhat hidden function called *renameStructField*, that can do the job, perhaps within a loop. Or use dynamic fi...

oltre 10 anni fa | 2

Risposto
how to create random numbers according to any distribution within a range
First, carefully read the help of RAND, especially the first example in it. The next step is to define your distribution more...

oltre 10 anni fa | 0

Risposto
I want to find the non-zero numbers in each row
help find

oltre 10 anni fa | 0

Risposto
Operands to the && operators must be convertible to logical scalar values.
Perhaps this example can help you in how to use logical operators with vectors: x = randn(1,20) y = randn(1,20) t...

oltre 10 anni fa | 0

Risposto
Any simple way to change a struct with fields of length "n" to a struct of length"n"?
This question clearly shows how _not_ thinking about your data management in the beginning will get you into trouble later on. ...

oltre 10 anni fa | 2

Risposto
How to delete the colon's in a matrix?
Is the data stored as strings in a cell array? C = {'1,6:3','2,5:3','99,103:4'} C2 = strrep(C,':',',')

oltre 10 anni fa | 0

Risposto
How to generate a matrix of all permutations of numbers ignoring repeats
Does this produce your result? Note that the matrices become too large very rapidly ... My function PERMPOS can be download...

oltre 10 anni fa | 0

Risposto
I want to plot some thing like this picture how can i do this ?
Use *AXES* to create a new axis relative to the another axes x = 0:100 ; y = exp((x/50).^2)+rand(size(x)) ; % some data ...

oltre 10 anni fa | 1

| accettato

Risposto
Find exact time step
Let S be your vector of speeds, and T your time points % Determine, for each time point, is the subject running or not ...

oltre 10 anni fa | 1

Risposto
problem with input names of vectors loaded in a function
Do not store your data like this. It is the contents of a variable that should change, not the name itself. In your case, you...

oltre 10 anni fa | 0

Risposto
GUI Question: Have a pop-up dialog which has license agreement? Accept/Decline pushbuttons.
Sure! You can, for instance, use *QUESTDLG* for this: function Main disp('Welcome to this function.') ; ButtonNam...

oltre 10 anni fa | 0

Risposto
How to change plotyn plot curve lines to stairs line
Can't you use *STAIRS*? An example: x = 0:.2:pi/2 ; y = sin(x) ; plot(x,y,'bo-') ; hold on ; stairs(x,y,'r.-') ...

oltre 10 anni fa | 1

| accettato

Risposto
Replace elements of sparse matrix from a full matrix.
What don't you replace the elements before converting it?

oltre 10 anni fa | 0

Risposto
How can I get the Mastering Matlab Toolbox
Duane Hanselman retracted all the files from the Matlab File Exchange, but the book has its own website where you can download t...

oltre 10 anni fa | 1

| accettato

Risposto
The value of each iteration is not recorded in cell
You want to loop over several elements: *for k = 1:11* rather than *for k = 11*

oltre 10 anni fa | 0

| accettato

Risposto
How to generate 500 permutations of any vector length 20? I am getting error
To generate one permutation of y you can use randperm Y = [45 45 45 45 45 45 0 0 30 30 0 0 0 0 45 45 45 45 45 45]; R = r...

oltre 10 anni fa | 0

| accettato

Risposto
How do I avoid using for loop when I want to treat the rows of a matrix individually?
This will work for unique rows of A: B=[1 2 1 3;1 2 1 4;1 3 1 4;1 2 1 6;1 4 1 5;1 5 1 3;1 5 1 7]; A=[1 2;1 5]; D=[1 3...

oltre 10 anni fa | 0

Risposto
How to restrict the range ?
I do not see why you need bsxfun for this. If X is your signal, this statement restricts X between -1 and 1 X = [0.5 1 2 -2...

oltre 10 anni fa | 0

| accettato

Risposto
How to extract a row of 2D cell array and store it in another 1D cell array?
As for any 2D array, each row of a 2D cell array has to have the same number of elements. I assume you meant to say that *each c...

oltre 10 anni fa | 1

Carica altro