Community Profile

photo

Paolo


108 total contributions since 2018

Paolo's Badges

  • 3 Month Streak
  • Knowledgeable Level 3
  • Thankful Level 1
  • Solver
  • First Answer

View details...

Contributions in
View by

Answered
how to extract certain data points from a long array based on certain criteria
veh_velo = [0,0,1,3,7,9,11,15,18,20,19,19]; accel_pedal = [0,0,2,4,6,9,10,11,12,13,13]; accel_pedal(veh_velo >= ...

1 day ago | 0

| accepted

Answered
listing folders in directory with specific strings
You can work around it with a dos command: [status,cmdout] = dos("dir *") list = regexp(cmdout,'\d{6}-[A-Za-z]+','match');...

1 day ago | 0

| accepted

Answered
How can I define a variable with a name based on an input?
If I am understanding your question correctly, you can use: ship_name = input('Name of the ship: ','s'); assignin('base'...

4 days ago | 1

| accepted

Answered
Extract Variables from mixed string
You can use: mystring = '# Message: onset_pic1_8.png'; matches = regexp(mystring,'\d|[a-z]+(?=_|\d)','match') >>mat...

5 days ago | 2

Answered
How to get sum of a range
You want to use the OR operator here and not the AND. Use: nnz(v<2 | v>4)

6 days ago | 0

| accepted

Answered
how to delete row and column at a single command????????????
A(:,2:2:4) = []; A(2:2:4,:) = [];

6 days ago | 0

Solved


Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

19 days ago

Answered
Read data from a .txt file with two columns
If you want a cell array you can use: fileID = fopen('mytext.txt'); mydata = textscan(fileID,'%f%f','HeaderLines',1); ...

19 days ago | 0

Answered
Problem 10 of MATLAB cody challenge
You can use: all(diff(x)>0)

21 days ago | 0

Answered
How to clear out rows of zeros in a matrix?
Let a be your matrix: a(a(:,1)==0,:) = [];

24 days ago | 0

| accepted

Answered
converting cells with strings inside cells into strings inside cells
cellfun(@(x) regexp(x,'(?<=@)(.*)(?=@)','match'),array_of_strings) Or cellfun(@(x) regexp(x,'(?<=@)(.*)(?=@)','tokens','...

24 days ago | 1

| accepted

Answered
How to plot the occurency of an element?
For the vector a you specified period should be 1:8. Use: period = [1:8]; a = [1 1 1 2 3 3 6 6 6 6 6 7 8 8]; n = histcou...

25 days ago | 0

| accepted

Answered
If I have a matrix My matrix is: BB = [-1 5 6;4 -3 2;5 6 -7]. How to print only positive values using a while loop?
>> BB(BB>0)' ans = 4 5 5 6 6 2 if you must use a loop: ii = 1; BB = [-1 5 6;4 -3 2; ...

25 days ago | 0

| accepted

Answered
How do I count the number of new occurrences of a number in an array?
nnz(diff([0 (x==1)])==1)

25 days ago | 1

Answered
How to filter out rows with NaNs from one variable and the same rows from another variable without NaNs.
indx = isnan(Y); Y(indx) = []; X(indx,:) = [];

25 days ago | 0

Answered
Convert serial number dates to month and year
mydate = datetime(736473,'ConvertFrom','datenum','Format','yyyy-MM')

25 days ago | 1

| accepted

Answered
Accessing multiple logical array indexing results at the same time
If I am understanding correctly the following code should solve your problem: test = magic(4); equalToTwo = find(test == 2...

25 days ago | 0

| accepted

Answered
how can i count a cell in a randi vector
histcounts(randi(4,1,50)) The output of the function is the occurrences of numbers one to four respectively.

26 days ago | 0

Answered
Why does can't I assign number greater than 1 to a matrix?
~eye(3) returns a logical array. You must convert it to double. Use: logicalMat = ~eye(3); myMat = double(logicalMat); m...

26 days ago | 0

Answered
How do I find no. of instances of each value till it changes?
This can be achieved nicely with regular expressions. Capture a digit and backreference back to the same digits to find the patt...

1 month ago | 0

Answered
Sum in groups of ones and zeros
A possible solution: For ones: [sindx,endindx] = regexp(char(idx+'0')','1*') indx = arrayfun(@(x,y) x:y,sindx,endindx,'...

1 month ago | 0

Answered
How can I specify the file path for csvwrite to write a file to?
csvwrite('C:\Users\T4H14\Documents\myfile.csv',mydata)

1 month ago | 1

| accepted

Answered
regexp split at first whitespace
You may use the *once* option to split only once at the first occurrence of whitespace. splitcells = regexp(data,'\s','split...

1 month ago | 1

| accepted

Answered
Adapting the datetime function
You must use the correctly specifiers for 'InputFormat', *mm* for minutes and *ss* for seconds. str = "13.07.2018 09:59:30....

1 month ago | 1

| accepted

Answered
Extract only numbers from a text file
str = 's.CircleByCenterPerimeter(center=(9.7593, 11.2643), point1=(9.8851, 11.2643))'; regexp(str,'(?<=\()-?\d+\.?\d+','match...

1 month ago | 0

| accepted

Answered
Sorting file (from a text file) and copying file to the new folder
If I am understanding the question correctly the following should help you: fid = fopen('SubjectsID.txt') while ~feof(fid)...

1 month ago | 0

Answered
How to create this monotonically increasing list of numbers?
V = [1 1 2 1 2 3 1] n = 1:numel(V); L = repelem(n,V)

1 month ago | 2

| accepted

Answered
Matrixr edundant rows removal
newmatrix = oldmatrix(find(uniquetol(oldmatrix(:,1))),:)

1 month ago | 0

| accepted

Answered
How to filter data from multiple columns in a table
No loop is necessary. Yes, you need to use strcmp for the comparison. MT= {7 3 '15' 'response1'; 7 4 '25' 'response2';...

1 month ago | 0

| accepted

Answered
Find row in a matrix A corresponding to the row another matrix B
If I am understanding the question correctly the answer is simply: >>C = A(B==max(B),:) C = Columns 1 through 7 -...

1 month ago | 0

| accepted

Load more