Answered
I need help with using the input function
_"I'm just having a lot of trouble saving this as a script and I have no clue how to use the input() function in this case!"_ ...

9 years ago | 2

Answered
Is there a way to pause the tic timer (without resetting tic)?
No, |tic| and |toc| do not support this. Download and try these, they support "pause": <https://www.mathworks.com/matlabcentr...

9 years ago | 1

Answered
how to write the coding of mean value of L?
mean(L(:))

9 years ago | 0

Answered
Share script variable with GUI variable
First you should *pass* that variable as an *input argument* to the GUI function. Then you can use any of the methods described ...

9 years ago | 0

Answered
How to generate a large integer from smaller integers?
Pure math solution, no bit-bashing: >> val = 4420217; >> vec = fix(mod(val./256.^(floor(log2(val)/8):-1:0),256)) vec ...

9 years ago | 3

| accepted

Answered
Making a user input a matrix
x = []; y = []; pmt = 'Enter comma-separated pairs. Press <Enter> with no data to exit. '; while true str = in...

9 years ago | 0

Answered
How can I put data from a function into columns using frprintf
fprintf('...',[x(:),yf(:),ym(:),yw(:)].')

9 years ago | 2

| accepted

Answered
trying to iterate through a vector changing the value of 1/5 in each iteration ?
N = size(A,1); for k = 1:N b = zeros(1,N); b(k) = 1/5; x = A\b; end

9 years ago | 1

| accepted

Answered
How to create a Looped Colum Matrix?
V = linspace(0,1,1441); V = repmat(V(:),365,1); The simpler example: V = [1;2;3]; V = repmat(V(:),2,1);

9 years ago | 0

| accepted

Answered
Search matrix for array of values and place results into another
>> A = [2,87,35,9,82,3;77,6,7,92,14,5;98,64,4,8,33,17;71,7,54,34,2,8;9,1,13,18,2,7]; >> B = 1:10; >> C = [44,32,2,13,22,...

9 years ago | 0

| accepted

Answered
How to extract lengths of sequences from a binary vector?
>> x = [0 0 1 1 1 0 1 0 0 0 0 1 1 0]; >> idx = find([1,diff(x),1]); >> idx(2:end)-idx(1:end-1) ans = 2 3 1 ...

9 years ago | 0

Answered
How to find first occurrences of a number in the beginning of blocks of that number?
>> vec = [1,2,2,3,0,0,0,3,3,3,0,1,1,3,3,4]; >> idx = diff(vec==0)>0; >> idb = find([true,idx]); >> ide = find([idx,tr...

9 years ago | 0

Answered
Average of group of non zero elements in an array
>> A = [0,0,0,0,4,3,5,6,7,0,0,0,0,2,3,4,5,0,0,0]; >> D = diff([true;A(:)==0;true]); >> idb = find(D<0); >> ide = find...

9 years ago | 0

| accepted

Answered
How can i split a large integer into fix size groups?
>> S = '2329363532333233313131363536353635254B53484744534A4844534A4B4A4B4A4B6146484A484A765E383838382A2A2A2A2F313432333600'; ...

9 years ago | 1

| accepted

Answered
How do I run a function every time the plot changed?
<https://www.mathworks.com/help/matlab/matlab_oop/learning-to-use-events-and-listeners.html> <https://www.mathworks.com/help/...

9 years ago | 0

| accepted

Answered
Indexing large dataset in for loop and renaming
This is a classic example of how |eval| makes code complex and buggy, and then makes it hard to debug. When beginners (and se...

9 years ago | 2

| accepted

Answered
Selecting Numbers from a String in a Matrix
_"The output was {1×7 cell} again."_ _"Does someone know what the error could be?"_ There is no error, because that is the...

9 years ago | 1

| accepted

Answered
How do I create an array of a function output?
*Method one: nested loops and indexing* m = 0:3; n = 0:4; out = nan(numel(m),numel(n)); for km=1:numel(m) f...

9 years ago | 0

| accepted

Answered
How to properly input a range in a vector
The simplest is to use the character |':'| >> A = [1,2,3;4,5,6] A = 1 2 3 4 5 6 >> range = ':'; ...

9 years ago | 2

Answered
Matrix division reccursively through mean calculation
The simplest solution is: sort(V) However if you really want to use a recursive function then: function out = myfun...

9 years ago | 0

Answered
waveletAnalyzer_Not enough input arguments.
These clearly show that you have shadowed |rats| with a file in your user directories: C:\Users\ASUS\Documents\MATLAB\rats....

9 years ago | 0

| accepted

Answered
Assgin a name to sequentially imported files
I don't see any reason why you need to use a structure: it just makes accessing the data more complex for you and serves no obvi...

9 years ago | 0

| accepted

Answered
How to plot a y=e^x function
y = exp(x) <https://www.mathworks.com/help/matlab/ref/exp.html>

9 years ago | 3

| accepted

Answered
Going from one while loop to another
The syntax |a<b<c| is not supported by MATLAB, as all logical comparisons are binary operators, so you would need |a<b & b<c|. N...

9 years ago | 0

| accepted

Answered
How to extract substring from string?
Simpler to use <https://www.mathworks.com/help/matlab/ref/regexprep.html |regexprep|>: >> str = 'robin goes to mary'; >>...

9 years ago | 1

Answered
how to increase the number of samples in a vector using interpolation
>> vec1 = [3 5 2 1]; >> vec2 = [4 5 3 4 3 1 4]; >> xo1 = 1:numel(vec1); >> xo2 = 1:numel(vec2); >> xi1 = linspace(...

9 years ago | 2

| accepted

Answered
Why am I getting inconsisant results with sscanf? I am expecting a result with five number. In the first two below I get five, in the second two I get three.
This happens because (as is clearly explained in the <https://www.mathworks.com/help/matlab/ref/sscanf.html |sscanf|> documentat...

9 years ago | 2

| accepted

Answered
Creating a matrix using the for loop function
Or in one line: [1/2;zeros(n-1,1)]

9 years ago | 0

Answered
Combining matrices by using for loop
n = number of iterations arr = nan(11,8,n); for k = 1:n new = ... arr(:,:,k) = new end and then to g...

9 years ago | 0

| accepted

Answered
Update matrix inside KeyPressFcn
MATLAB is pass-by-value, so when you change |responses| inside the callback function it _does_ get changed... but only inside _t...

9 years ago | 0

| accepted

Load more