Answered

Delete zero rows from a table

For a table named t: t(~t.speed,:) = []

Delete zero rows from a table

For a table named t: t(~t.speed,:) = []

6 years ago | 1

| accepted

Answered

Extracing the part of the string from cell array

regexp(a,'(?<=__)(.*)','match')

Extracing the part of the string from cell array

regexp(a,'(?<=__)(.*)','match')

6 years ago | 2

| accepted

Answered

Find string in excel file

text = {'T_DCT_PK_WDT_W01B1_RANGE'; 'T_DCT_PK_WDT_W01B2_RANGE'; 'T_DCT_PK_WDT_W02B1_RANGE'; 'T_DCT_PK_WDT_W02B2_RANGE'} ...

Find string in excel file

text = {'T_DCT_PK_WDT_W01B1_RANGE'; 'T_DCT_PK_WDT_W01B2_RANGE'; 'T_DCT_PK_WDT_W02B1_RANGE'; 'T_DCT_PK_WDT_W02B2_RANGE'} ...

6 years ago | 0

Answered

Populate cell array dynamically

ssnname = {'D1S02';'D3S11';'D3S12'} ssnend = [10 20 24] ssnend = num2cell([ssnend(1) diff(ssnend)]) output = cellfun...

Populate cell array dynamically

ssnname = {'D1S02';'D3S11';'D3S12'} ssnend = [10 20 24] ssnend = num2cell([ssnend(1) diff(ssnend)]) output = cellfun...

6 years ago | 0

| accepted

Answered

I'm not sure why what I wrote isn't working in terms of extracting the string I want.

filename = 'Synch_ab001.mat'; subjectname = regexp(filename,'(?<=_)(.*)(?=\.\w*)','match')

I'm not sure why what I wrote isn't working in terms of extracting the string I want.

filename = 'Synch_ab001.mat'; subjectname = regexp(filename,'(?<=_)(.*)(?=\.\w*)','match')

6 years ago | 0

| accepted

Answered

Hey guys, i need help with vector maniuplation

v = -3:1:3 w = v w(w<0) = w(w<0)*2

Hey guys, i need help with vector maniuplation

v = -3:1:3 w = v w(w<0) = w(w<0)*2

6 years ago | 1

| accepted

Answered

Vector with various IFs, adding up and counting down

X = [ 5 2 -4 -6 -2 1 4 2 -3 -6 -1 8 9 ]; indx = find(X<0); Y = [zeros(1,indx(1)-1) cumsum(X(indx(1):end))]; Y(Y>0) = 0; ...

Vector with various IFs, adding up and counting down

X = [ 5 2 -4 -6 -2 1 4 2 -3 -6 -1 8 9 ]; indx = find(X<0); Y = [zeros(1,indx(1)-1) cumsum(X(indx(1):end))]; Y(Y>0) = 0; ...

6 years ago | 0

Answered

How do I Subscript Duration Row times with Date Time values?

opts = detectImportOptions('QuakeTrials.csv'); opts.MissingRule = 'omitvar'; T = readtable('QuakeTrials.csv',opts); T.D...

How do I Subscript Duration Row times with Date Time values?

opts = detectImportOptions('QuakeTrials.csv'); opts.MissingRule = 'omitvar'; T = readtable('QuakeTrials.csv',opts); T.D...

6 years ago | 0

Answered

Extracting a number from certain line of .txt file

For the values which follow "COLLAPSE MULTIPLIER = ", you can simply use a positive lookbehind which checks for the pattern you ...

Extracting a number from certain line of .txt file

For the values which follow "COLLAPSE MULTIPLIER = ", you can simply use a positive lookbehind which checks for the pattern you ...

6 years ago | 0

| accepted

Answered

Excluding one vector from another vector with repetition

S=[1 3 0 2 0 0]; C=[0 2]; [~,col] = ismember(C,S); S(col) = []; S = 1 3 0 0

Excluding one vector from another vector with repetition

S=[1 3 0 2 0 0]; C=[0 2]; [~,col] = ismember(C,S); S(col) = []; S = 1 3 0 0

6 years ago | 2

| accepted

Answered

Selecting points from a matrix

x = [9,10,3,2,6;3,1,7,8,10]; x = 9 10 3 2 6 3 1 7 8 10 x(x<9 | x>10) = 0; ...

Selecting points from a matrix

x = [9,10,3,2,6;3,1,7,8,10]; x = 9 10 3 2 6 3 1 7 8 10 x(x<9 | x>10) = 0; ...

6 years ago | 0

| accepted

Answered

Convert part of a string to number

You can use <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp> to simply match the digits in your input. NA = reg...

Convert part of a string to number

You can use <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp> to simply match the digits in your input. NA = reg...

6 years ago | 0

| accepted

Answered

Removing specific characters from string in nested cells

Perhaps this can easily be achieved in two steps. For your input: 1 ****TABLE1**** COLUMN1= 1.12, 2.23, 3.34, 4.45,...

Removing specific characters from string in nested cells

Perhaps this can easily be achieved in two steps. For your input: 1 ****TABLE1**** COLUMN1= 1.12, 2.23, 3.34, 4.45,...

6 years ago | 0

| accepted

Answered

Extracting parts of a string

The following code uses <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp> to extract the data you want. You can play...

Extracting parts of a string

The following code uses <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp> to extract the data you want. You can play...

6 years ago | 0

| accepted

Answered

How can I get successive difference and later add all the difference?

x = [735954.715277778 735954.716412037 735954.717766204 735954.717824074 735954.717916667 735954.863611111 735955.043206019 735...

How can I get successive difference and later add all the difference?

x = [735954.715277778 735954.716412037 735954.717766204 735954.717824074 735954.717916667 735954.863611111 735955.043206019 735...

6 years ago | 1

| accepted

Answered

If I have file names listed in a readtable how do I get it to extract part of the file name?

You have two options for extracting that data. The first is the simplest one. Since you said that that information always occu...

If I have file names listed in a readtable how do I get it to extract part of the file name?

You have two options for extracting that data. The first is the simplest one. Since you said that that information always occu...

6 years ago | 0

| accepted

Answered

Remove rows with NaN from a table

Use <https://uk.mathworks.com/help/matlab/ref/rmmissing.html rmmissing> : T = table([38;43;38;40;49],[71;NaN;64;67;64],[176...

Remove rows with NaN from a table

Use <https://uk.mathworks.com/help/matlab/ref/rmmissing.html rmmissing> : T = table([38;43;38;40;49],[71;NaN;64;67;64],[176...

6 years ago | 3

| accepted

Answered

How to read a data from txt file: only a specific part of txt

You can use <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp> to match the sampling value. The expression below assu...

How to read a data from txt file: only a specific part of txt

You can use <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp> to match the sampling value. The expression below assu...

6 years ago | 0

| accepted

Answered

Extracting a file path from a .txt file

You can use <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp> to match the path in your .txt file. corr = filere...

Extracting a file path from a .txt file

You can use <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp> to match the path in your .txt file. corr = filere...

6 years ago | 0

Answered

Reading, finding and storing the lines from comma-separated text file into a matrix

The best way to parse your .txt file is probably <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp>. corr = filer...

Reading, finding and storing the lines from comma-separated text file into a matrix

The best way to parse your .txt file is probably <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp>. corr = filer...

6 years ago | 0

Answered

Remove text from a text file without otherwise altering the file

You can use <https://uk.mathworks.com/help/matlab/ref/regexprep.html regexprep> for this purpose. x1 = 'G1 X104.650 Y95.350 ...

Remove text from a text file without otherwise altering the file

You can use <https://uk.mathworks.com/help/matlab/ref/regexprep.html regexprep> for this purpose. x1 = 'G1 X104.650 Y95.350 ...

6 years ago | 0

| accepted

Answered

Extract specific rows or columns containing letters (xxx) From dat File in Matlab

The code below reads the xlsx file as a table |t| using <https://uk.mathworks.com/help/matlab/ref/readtable.html readtable> and ...

Extract specific rows or columns containing letters (xxx) From dat File in Matlab

The code below reads the xlsx file as a table |t| using <https://uk.mathworks.com/help/matlab/ref/readtable.html readtable> and ...

6 years ago | 0

| accepted

Answered

How do i get thindex of the rows where 'NaN' elements are there in a cell array?

Find the rows where NaN occurs, with "a" being your cell array: [row,~]= find(cell2mat((cellfun(@(x) any(isnan(x)),a,'un',0...

How do i get thindex of the rows where 'NaN' elements are there in a cell array?

Find the rows where NaN occurs, with "a" being your cell array: [row,~]= find(cell2mat((cellfun(@(x) any(isnan(x)),a,'un',0...

6 years ago | 0

| accepted

Answered

how can remove words and split in cellarray in matlab

*For input*: x = {'100614,Peter Beadle,131542'} You can use <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp>...

how can remove words and split in cellarray in matlab

*For input*: x = {'100614,Peter Beadle,131542'} You can use <https://uk.mathworks.com/help/matlab/ref/regexp.html regexp>...

6 years ago | 1

| accepted

Answered

Getting the minimum distance in a coordinates array

Your input: x = [938;810;147;1162;494;383;203]; y = [845;1012;875;810;1039;897;1010]; Sort x: [tmpx,i] = sort(x); ...

Getting the minimum distance in a coordinates array

Your input: x = [938;810;147;1162;494;383;203]; y = [845;1012;875;810;1039;897;1010]; Sort x: [tmpx,i] = sort(x); ...

6 years ago | 0

Answered

How do I delete specific elements from a matrix?

Tijdgoed((Tijdgoed > 10 | Tijdgoed <-10)) = []; You can confirm by using: find(Tijdgoed>10) find(Tijdgoed<-10) wh...

How do I delete specific elements from a matrix?

Tijdgoed((Tijdgoed > 10 | Tijdgoed <-10)) = []; You can confirm by using: find(Tijdgoed>10) find(Tijdgoed<-10) wh...

6 years ago | 1

| accepted

Answered

How can i Replace missing values from Timetable

Input timetables: tt1: Time Var1 ___________ ____ 13-Apr-2018 30.1 25-Apr-2018 NaN...

How can i Replace missing values from Timetable

Input timetables: tt1: Time Var1 ___________ ____ 13-Apr-2018 30.1 25-Apr-2018 NaN...

6 years ago | 0

| accepted

Answered

Color of plots when there are multiple plots

Since you specified that you do not wish to specify the color manually, you can use: plot(Date,A,'Color',rand([1 3])) To ...

Color of plots when there are multiple plots

Since you specified that you do not wish to specify the color manually, you can use: plot(Date,A,'Color',rand([1 3])) To ...

6 years ago | 0

| accepted

Answered

How to keep unique rows

You can determine the common values between the two cell arrays with <https://uk.mathworks.com/help/matlab/ref/intersect.html in...

How to keep unique rows

You can determine the common values between the two cell arrays with <https://uk.mathworks.com/help/matlab/ref/intersect.html in...

6 years ago | 1

| accepted

Answered

merging date and time

Nicole, the following example should help you in what you are trying to do. I have added some comments in the code to help you. ...

merging date and time

Nicole, the following example should help you in what you are trying to do. I have added some comments in the code to help you. ...

6 years ago | 3