Answered
I have to do to correct this error
Solution: don't name your function |disp|.

11 years ago | 0

Answered
How do I fix the error: In an assignment A(:) = B, the number of elements in A and B must be the same.?
You have defined each of |rowpoints| and |columnpoints| to have 2000 elements. These values are then converted to linear indices...

11 years ago | 1

Answered
timing issues. help?
One easy way is to load or define the sound, then play it using <http://www.mathworks.com/help/matlab/ref/sound.html |sound|>. ...

11 years ago | 0

| accepted

Answered
How to make a plot smooth
It sounds like you want a kind of interpolation, because _"smoothing"_ usually trims the values of the extreme points of a curve...

11 years ago | 4

| accepted

Answered
How can i save several 2-dimension-Matrices in a 3-dimension-Matrix
Try this: for k=1:N tmp = exsearch2(A,B(k),C(k)); X(1:size(tmp,1),:,k) = tmp; end This works by sim...

11 years ago | 1

| accepted

Answered
How to fprintf with
The easiest solution is to supply the string as an argument, and not define it in the *format string* itself, then you do *not* ...

11 years ago | 1

Answered
i am getting error in this code like "Subscripted assignment dimension mismatch". please tell how to solve it
This code has many little "features" that could be simplified, for example: * try to avoid using _both_ uppercase and lowerca...

11 years ago | 1

| accepted

Answered
Create a structure name based on the string of a variable. Create fieldnames in this structure.
The simplest answer would be to use a <http://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements-of-a-nonscalar-...

11 years ago | 2

| accepted

Answered
How to access elements of a structure without the use of a loop ?
You can do this without any loops or |cellfun| if you rearrange the data a little bit. The following two changes would need to b...

11 years ago | 1

Answered
Machine learning, ensemble methods, regression trees
<http://www.mathworks.com/help/stats/fitctree.html> <http://www.mathworks.com/help/stats/classification-trees-and-regression-...

11 years ago | 0

Answered
substitute every n elements of a vector
It may be that using a loop is actually faster than other solutions, and less obfuscated: num = 3; % start index stp = 6...

11 years ago | 0

| accepted

Answered
Why exist gives an answer even when the variable does not exist?
When you actually read the <http://www.mathworks.com/help/matlab/ref/exist.html documentation for |exist|>, you will find that a...

11 years ago | 2

| accepted

Answered
how to split a number?
>> x = 2.3*10^5; >> y = 10^floor(log10(x)) y = 100000 >> z = x/y z = 2.3

11 years ago | 0

| accepted

Answered
Check if subsequent elements in a 3D matrix are the same value
>> Y2 = X(:,:,1:end-1) & X(:,:,2:end); >> Y3 = X(:,:,1:end-2) & X(:,:,2:end-1) & X(:,:,3:end); >> sum(Y2,3) % two consec...

11 years ago | 0

| accepted

Answered
Can't get cell value
X{1,1}(1) * |()| parentheses always return the cell or element of the *same class*. * |{}| curly braces always refer to th...

11 years ago | 0

| accepted

Answered
this is my question,I write a txt named "data", when I load this data.txt,the programme is wrong..my programme and result show below,What should I do?
The commas in your data file are the problem. Commas are used in many languages as the decimal radix (as opposed to the decimal ...

11 years ago | 0

| accepted

Answered
In general if 2 is divided by 10 then the answer is 0.2 and the remainder is 0.0. but MATLAB shows the remainder is 2.0.... why?
Because that is how the standard definition of the <https://en.wikipedia.org/wiki/Modulo_operation modulo operation> works, and ...

11 years ago | 1

Answered
I need a function that returns the smallest prime number p smaller than 100,000 such that (p + n) is also prime, where n is a scalar integer and is the sole input argument to the function
function p = prime_pairs(n) V = primes(1e5); V = V(isprime(n+V)); if isempty(V) p = -1; else p = V(1); ...

11 years ago | 0

| accepted

Answered
Is there a better (faster) way to code this?
You could simply use <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorized code>: l = 2; N = 3...

11 years ago | 1

Answered
export data of a loop in different excel files
Try reading the documentation for <http://www.mathworks.com/help/matlab/ref/xlswrite.html |xlswrite|>, and thinking about how yo...

11 years ago | 1

| accepted

Answered
Sort a vector in matlab
For clarity I have not included the indices, but these are simple to include if required. >> inp = [10;11;12;15;16;17;18;19...

11 years ago | 0

| accepted

Answered
How to select one element of vector and divide it on the summation of the rest elements???
This is much easier and faster to solve using <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorized co...

11 years ago | 1

| accepted

Answered
How to read several text files in a loop
Processing a sequence of file is comprehensively explained in the wiki, together with example code: <http://matlab.wikia.com/wik...

11 years ago | 0

| accepted

Answered
How to suppress output of function when calling from another function?
Probably the easiest way of doing (almost) what you want is to use <http://www.mathworks.com/help/matlab/ref/nargout.html |nargo...

11 years ago | 0

| accepted

Answered
about cat function in matlab
The documentation is a really good place to find out how things work and what they do: <http://www.mathworks.com/help/matlab/...

11 years ago | 1

Answered
how to get matrix value right?
Actually MATLAB _is_ displaying the correct values, but they are simply being displayed using <https://en.wikipedia.org/wiki/Sci...

11 years ago | 0

| accepted

Answered
How to access variable from workspace and set it as value of a text box.
Read these: <http://www.mathworks.com/help/matlab/matlab_prog/share-data-between-workspaces.html> <http://www.mathworks.co...

11 years ago | 0

Answered
Find elements in cell array (logical 0 or 1)
Use <http://www.mathworks.com/help/matlab/ref/strcmp.html |strcmp|> like this: >> A = {'XYZ';'DHU';'EYU';'XYZ';'XYZ'} A ...

11 years ago | 0

Answered
Strange error message using sort( ) ?
You have defined a variable called |sort|, and this is shadowing (i.e. hiding) the inbuilt <http://www.mathworks.com/help/matlab...

11 years ago | 0

| accepted

Answered
A specific line of a .m file slows down the speed (potential bottleneck?)
Idea 1: remove |cellfun| and use a loop: this is usually faster. |cellfun| makes tidy code, but is slow. Idea 2: ditch the ce...

11 years ago | 0

| accepted

Load more