Answered
combining lots of vectors of unequal length
I don't think there is a generic code. How about making a function to do this, like: function [d1,d2] = yourFunction(a,b,c)...

8 years ago | 0

Answered
How can i create a matrix with samples from irregular X,Y
One possible solution would be like this: Am01 = [1 2 3 4 5 ; 10 20 30 40 50]'; Am02 = [1 3 4 ; 30 20 50]'; Am03 = [1 2 5...

8 years ago | 0

| accepted

Answered
substitute values from one matrix to another
How about using |ismember| function, like: [~,loc] = ismember(A(:,1),B(:,1)); C = [A(:,1),B(loc,2)];

8 years ago | 0

| accepted

Answered
How to creat a for loop to a time serie interpolation ????
You can use |timetable| and |retime| functions to obtain time series interpolation, like: % Original sample (TT) and interp...

8 years ago | 0

Answered
I want to make a matrix with x,y values from ginput. How can I do it?
Simply, you should try M = [x,y];

8 years ago | 0

Answered
How can i count different number pairs in a huge matrix?
One possible way to do this would be like this: A = [1 2 3 4 5; 2 1 2 3 5; 5 6 7 1 2]; Seg = [1 2]; strA = stri...

8 years ago | 0

Answered
1 have 3 csv files of various sizes with timestamps (TS) in Column 1 of each csv. 2 csv files will always have same size matrix, but third csv TS is delayed which causes a smaller matrix. How do I pad third csv with 0's until TS3 = TS1 or TS2?
Assuming your data in 3 csv files are stored in |timetable|, say TT1 TT2 and TT3, you can pad the data in TT3 with 0s until TT3'...

8 years ago | 0

| accepted

Answered
フォルダ内の複数枚存在する画像の操作
もし対象画像の拡張子が決まっている場合は、以下のようにしても更新日時が最新の画像を読み込むことができます。 % カレントフォルダ内の *.jpg ファイル一覧をテーブル形式で取得 fileList = struct2table(dir('....

8 years ago | 6

| accepted

Answered
How do i plot a struct with multiple cells
You can use |getfield| function to access data in your nested structure, like: for kk = 0:1300 cyc = sprintf('cyc%04d'...

8 years ago | 1

| accepted

Answered
How to generate integer random numbers of specific range including all numbers between the range?
I believe what you want to do is like this? n = 5; m = 5:10; Top = zeros(n,numel(m)); for kk = 1:n idx = ra...

8 years ago | 0

Answered
Copy text file into different array depending on character in the first cell
How about the following script? In this example, I assumed 'behavioural', 'all saccades' and 'micro saccades' data line start wi...

8 years ago | 1

| accepted

Answered
How can I drag points vertically in a plot?
The solution would be like this. Please save the following code as an script file, and run it. % Plot a line and points ...

8 years ago | 8

| accepted

Answered
could anyone help me to solve this issue.
Like this? iwant = [34 12 24 13 23 14]; c = num2cell(erase(num2str(iwant),' ')); output = str2double(c); In this case,...

8 years ago | 0

Answered
How to take RMS of every 10 values in a matrix and output this?
Another possible solution: A = randi(9, 66000, 4); % Sample matrix g = repelem([1:6600]',10); % Create group ID ...

8 years ago | 0

Answered
How to plot intensity profile of an image
Like this? I = imread('Capture.PNG'); x = [0 size(I,2)]; y = [size(I,1)/2 size(I,1)/2]; c = improfile(I,x,y); f...

8 years ago | 4

| accepted

Answered
From date and time in different columns to datetime
Assuming your data is stored in CSV file like the attached, |readtable| function automatically recognize that 1st and 2nd column...

8 years ago | 0

| accepted

Answered
How to select specific row in a matrix
Assuming your data is stored in table format, say |T|, the following code can do that. func = @(x) T(T.aod == min(x),:); T...

8 years ago | 1

Answered
choose samples in for loop
Also, you don't need to use for-loop. For example, if you want to do that every 10th samples, you can calculate |count| easily b...

8 years ago | 0

Answered
I have air temperature dataset obtained in every 30 minutes for a day for a whole year. I want to extract maximum and minimum air temperature for each day for a year (365 days).
By using |timetable| and |retime| function, you can do that very easily. The following is an example: % Sample data Time...

8 years ago | 1

Answered
Data averaging on a specific cell of a matrix
You don't have to use for-loop for this. Assuming A1(1) and A1(1000) are not zero, and there is NO consecutive 0s, the following...

8 years ago | 0

| accepted

Answered
I want to apply a for loop to an array (say [1 2 3]) so that the output gives every possible combination of that array (i.e. [123], [132], [213], [231], [312], [321])
If the input is 1-by-3 array with different digits, like [1 2 3], the following code generates all possible combination. a ...

8 years ago | 0

Answered
matrix row extraction in
Like this? % Sample 128-by-1 vector x = (1:128)'; % Solution-1: nSeg = numel(x)/16; A = mat2cell(x,repmat(16,1,nSeg...

8 years ago | 0

Answered
Divide a matrix with an array along a specific dimension
How about using |arrayfun| ? C = arrayfun(@(k) A(:,:,k)./B(k), 1:30,'UniformOutput',false); C = cat(3,C{:});

8 years ago | 0

Answered
Reading .csv Files with different number of Columns
In R2017b and R2018a, |readtable| runction could read your data. If the number of columns changes, how about changing data-type ...

8 years ago | 1

| accepted

Answered
How do i omit NaN values from polyfit?
How about the following? filename = 'NB-Aroostook.xls'; numData = xlsread(filename); maxt = numData(:,3); length = (...

8 years ago | 5

| accepted

Answered
I am trying to transform a column of data
Assuming |A| is your 22-by-4 double array, the following can replace first column value by the "second column value divided by t...

8 years ago | 0

| accepted

Answered
How can I do a 80-20 split on datasets to obtain training and test datasets?
If you want to randomly select 80% of your data as training dataset, please try following: PD = 0.80 ; % percentage 80% ...

8 years ago | 2

Answered
How to to create timestamp from imported data when time data is sperated in three different columns (Month ,Day, Hour)
If |Months|, |Day| and |Hour| are vector with the same length, and assuming Year = 2018, the following can generate |datetime| v...

8 years ago | 0

Answered
Get means for nested categorical variables
Please try the following: [group,site,days] = findgroups(T.site,T.days); meanvar = splitapply(@mean,T.var,group); T1 = ta...

8 years ago | 0

| accepted

Load more