Answered
Is there a possibility to make a Start/Stop Pushbutton in guide?
_"Is there a possibility to just stop the measurement by using the same pushbutton and jump out of the function"_ Of course y...

8 years ago | 0

| accepted

Answered
How to replace half the number of specific element in an array?
To change random columns: >> A=[1 2 3 4 4 1 2 4 4 3 4 4 4 2 1 3 4 4 4 2 1 4 4] A = 1 2 3 4 4 1 2 4 ...

8 years ago | 1

| accepted

Answered
Extracting parts of a string
Importing the data as strings and then using regular expressions to parse them is inefficient, yet is not required because that ...

8 years ago | 0

Answered
How to add title and x/y-labels after generating multiple figures?
Your approach of obtaining and using explicit graphics handles is a good idea. However the axes title and axes labels are <https...

8 years ago | 0

| accepted

Answered
I have old code wavread and want to replace with audioread
audioread('all_sentences_train_DR1_MKLS0_M.wav',[1,signal_size]);

8 years ago | 0

| accepted

Answered
how to find specific .mat file
<https://www.mathworks.com/help/matlab/ref/exist.html>

8 years ago | 0

| accepted

Answered
How to convert an array of decimal values to binary?
>> x = [0 0 0 2 0 3 0 1 0 0]; >> c = dec2bin(x(:),2); >> reshape(c.',1,[])-'0' ans = 0 0 0 0 ...

8 years ago | 1

| accepted

Answered
Count number of elements in a matrix
_"Count number of elements in a matrix"_ That is exactly what histograms are: >> A = [1 2 3 4 5 6 7 8 9 10]; >> B = [...

8 years ago | 0

| accepted

Answered
Matlab getting progressively slower in running simulation
Because this: _"The loop is used to concatenate values to a matrix using the cat function_" forces MATLAB to move the array in m...

8 years ago | 0

| accepted

Answered
Adding integer to specifc matrix columns using bsxfun
M(:,2:end) = M(:,2:end)+1 or V = ones(1,size(M,2)); V(1) = 0; M = bsxfun(@plus,M,V)

8 years ago | 0

| accepted

Answered
Assigning values for vector with number sequence
All you need is this: fun = @(n)r1*(n:-1:0)+r2*(0:n); p = cell2mat(arrayfun(fun,1:n,'uni',0)) And tested (here I wrot...

8 years ago | 1

Answered
How can I write an accent in a French sentence on a figure (title, xlable,ylabel)
Note that strings and char vectors are different things, and so the apostrophe needs to be defined differently: str = "d'it...

8 years ago | 1

| accepted

Answered
How to access n vector elements, then skip n elements, then access the following n elements and so on?
Assuming that the number of elements of your vector |A| is exactly divisible by 20: M = reshape(A,20,[]) V = M(1:10,:) ...

8 years ago | 1

| accepted

Answered
Linear interpolation of matrix
>> M1 = [1,1,1;2,2,2]; >> M2 = [3,4,5;6,7,8]; >> P1 = 0; >> P2 = 1; >> Pq = 0.5; % your random point >> V = [re...

8 years ago | 0

Answered
Sort a list of files using Remainder after division
Here is an outline of one way to do it (untested, but should get you started): D = 'original folder'; S = dir(fullfile(D...

8 years ago | 1

| accepted

Answered
how to find common elements of two matrices considering also the repeated values?
This is easy with |sort|, assuming that both |A| and |B| contain exactly the same elements: >> A = [2;4;4;4]; >> B =...

8 years ago | 1

| accepted

Answered
fprintf in an OutPutFcn
Add this line at the start of the function: persistent FiD2 Each time the function is called it has no recollection of w...

8 years ago | 0

| accepted

Answered
How to solve issue with strncmp returning incorrect logical values for text comparison...
*Explanation:* The problem is caused by the file encoding, which is little-endian <https://en.wikipedia.org/wiki/Universal_Coded...

8 years ago | 1

| accepted

Answered
Reading data out of a character cell array - all values, and save those in a new variable
If that row of the cell array contains numeric values stored in char vectors, then you can easily convert these to numeric: ...

8 years ago | 1

| accepted

Answered
My image is RGB image but when I used size function it showed me grayscale image.
There is no problem, you just did not actually read the image into MATLAB. It works perfectly for me: >> [img,map] = imread...

8 years ago | 0

| accepted

Answered
Plotting multiple vectors from a function
Simpler than the accepted answer is to use a loop: for k = 1:N [Ax,Ay,Az] = yourFunction(...); plot3(Ax,Ay,Az) ...

8 years ago | 0

| accepted

Answered
Extracting the year from a timestamp in a column
Your code confuses a date vector (which is a simple double matrix of size Nx6 or Nx3) with a <https://www.mathworks.com/help/mat...

8 years ago | 0

| accepted

Answered
Accessing multiple cells from char array
First just |load| all of the files, and put the required data into a cell array: Folder = 'C:...' FileList = dir(fullf...

8 years ago | 1

| accepted

Answered
Why are the results of eigen values different for both versions 2016a and 2018a
<https://www.mathworks.com/matlabcentral/answers/393099-eigs-yields-different-results-on-different-versions> <https://www.mat...

8 years ago | 1

Answered
How can I substract one column of a matrix from another one of a different matrix in a loop?
Load into an output variable: S = dir('*.dat'); C = cell(1,numel(S)); for k = 1:numel(S) C{k} = load(S(k).name...

8 years ago | 0

Answered
code that generate 50 by 50 matrix of 0's and 1's of which 20% is 1's.
>> M = +(rand(50,50)<0.2); >> mean(M(:)) % testing ans = 0.19880

8 years ago | 0

| accepted

Answered
Readtable reads numerical row as strings
_"any way of doing this automatically?"_ I would start by setting the |format|. You could do this manually, i.e. repmat(...

8 years ago | 0

| accepted

Answered
What does Undefined operator '-' for input arguments of type 'string' mean?
NDVIs = (subplots(299,:)-subplots(195,:))./(subplots(299,:)+subplots(195,:));

8 years ago | 1

| accepted

Answered
Could you please tell me why the last part for the descending order isn“t working? Thank you!
Perhaps one of these does what you want: >> c = [4,5,3;10,30,50;200,900,40]' c = 4 10 200 5 30 ...

8 years ago | 1

Answered
GUI. Handle variable.
Your use of <https://www.mathworks.com/help/matlab/ref/guidata.html |guidata|> is perfect: calling it at the end of a callback f...

8 years ago | 0

| accepted

Load more