Answered
How to pick specific file name in directory
As Stephen-san and dpb-san mentioned, regular expression will help extract files based on file name. Here is one example to extr...

8 years ago | 0

| accepted

Answered
Simulate a five-state absorbing Markov chain
If you have Statistics and Machine Learning Toolbox, you can do this much easier, like: % Transition matrix trans = [... ...

8 years ago | 1

| accepted

Answered
textscan doesn't work well when I read 2 lines batch.
Seems that you need to add newline code (\n) or carriage return + newline codes (\r\n), like: data = textscan(fid,'%d / Pre...

8 years ago | 1

| accepted

Answered
How do I sample a random value from a matrix?
If you want to obtain |k| samples randomly from |A|, the following will do that. ind = randperm(numel(A),k); output = A(in...

8 years ago | 0

| accepted

Answered
How to plot the struct data. I am having an issue regarding plotting following data.
Like this? But, looking at your data, there are so many NaNs, and most of the data points are concentrated in some small clus...

8 years ago | 0

Answered
Time Series change point detection
|ischange| or |findchangepts| function will do that. If you could upload your data, I would be happy to check it. <https://jp...

8 years ago | 1

Answered
Eliminate rows in a matrix that have matching & different values
Assuming your matrix is |A|, the following code returns what you want as |B|. B = sortrows(A,[1 4]); idx = [false; diff(B(...

8 years ago | 1

| accepted

Answered
Printing values in a GF array
Like this? r0 = gf((0:1023),10,1387); val = r0.x; for kk = 1:numel(val) fprintf('r0(%d): %d\n',kk,val(kk)) end

8 years ago | 0

| accepted

Answered
Find Vector of Index Without Using Loop
Please try |ismember| function, like: [~,idx] = ismember(b,a);

8 years ago | 0

| accepted

Answered
How to Seperate Red Blood cells.
Hi Basit-san, Thanks for sharing your RGB image with us. The following is my preliminary try. As shown in the attached result...

8 years ago | 2

| accepted

Answered
plotting vectors of 3 population over years
I think you have to make year vector to plot your data, like: vec1 = [115600 765840 123423]; vec2 = [115100 765440 543245]...

8 years ago | 0

Answered
How to set the seed of cvpartition
Please add |rng| function just before |cvpartition| to set seed of the random number generation. Here is an simple example: ...

8 years ago | 2

Answered
Need to combine two matrix
How about the following? R = mat2cell([P(:) Q(:)],ones(1,numel(P))) R = reshape(R,[],2);

8 years ago | 0

| accepted

Answered
Loop to calculate area under curve using rectangle methode
Sorry for my late response. Here is an simple example. % Sample data dx = pi/10; x = 0:dx:2*pi; y = 1+sin(x); % int...

8 years ago | 0

Answered
How to count how many numbers are prime in each column
How about using |isprime| function? sum(isprime(onethousand)) It returns: >> sum(isprime(onethousand)) ans = ...

8 years ago | 0

Answered
Find and replace values in a cell array containing 3-D matrixes with numeric values
Another possible solution: YourCellArray = cellfun(@replaceZeroWithNan,YourCellArray,'UniformOutput',false); function ...

8 years ago | 1

| accepted

Answered
Finding duration of a signal
Looking at your variable |src1|, SampleFrequency and Data length are 5000000 and 50000, respectively. So, assuming physical unit...

8 years ago | 0

| accepted

Answered
make list with columnames
Column names of your table, say |T|, can be extracted by |T.Properties.VariableNames|. The following is a simple example. %...

8 years ago | 1

Answered
Read text file data
Like this? fid = fopen('YourData.txt','r'); C = textscan(fid,'%s%f%f%f%f%*4s','Delimiter',';'); fclose(fid); A = str...

8 years ago | 0

Answered
Finding out the average values per day
Like this? % Sample Data (Hourly values per day over 10 months) Time = [datetime(2018,1,1):hours(1):datetime(2018,10,1)]';...

8 years ago | 2

Answered
Finding out mean monthly values from daily values
By converting your |table| to |timetable| and using |retime| function, you can do it easily, like: load('hourly_wind_speeds...

8 years ago | 0

Answered
How to partition hourly Data by month
When your data has multiple columns, the following will work. % Sample hourly data from 1989/1/2 to 2004/12/31 Time = (dat...

8 years ago | 1

Answered
Norm of group of elements whose position is reported on a cell array
Like this? % Sample data x and class info cell array g x = rand(10,1); g = {[1 3 5 7 9],[2 4 6 8 10]}; % Calculate 2...

8 years ago | 0

| accepted

Answered
how to split an arabic handwritten text into 2 image : one for the dots and the other for the text ?
Using the attached screen capture image as an input image file, applying |regionprops| function and adjusting a threshold of pix...

8 years ago | 1

Answered
Polarplot with negative theta display
You can plot it by tuning axes properties, like: % Sample data theta = deg2rad(-150:30:180); rho = 10*rand(size(theta)); ...

8 years ago | 2

| accepted

Answered
Label X-axis title based on excel/csv header
By using |readtable| function, you can read header line in your csv file and put them to the figure. The following is an example...

8 years ago | 0

Answered
Undefined function or variable 'envspectrum'
The function |envspectrum| was introduced in R2017b, as shown at the bottom of the documentation page. So I would recommend upda...

8 years ago | 0

Answered
How to combine tables and add new row
OK, I understand the situation. How about the following script? Scene = {AA.Scene; BB.Scene; CC.Scene; DD.Scene]; T = [t...

8 years ago | 0

Answered
How can I replace value of specific cell value depending on another matrix?
If some rows in D does not have corresponding rows in A, need some more trick. Here is an example. % Sample data (1st and 4...

8 years ago | 0

Load more