Community Profile

photo

Stephen23


Active since 2014

Suspensa Vix Via Fit

Statistics

All
  • Most Accepted 2022
  • Most Accepted 2021
  • Personal Best Downloads Level 5
  • Editor's Pick
  • Grand Master
  • First Review
  • 5-Star Galaxy Level 5
  • GitHub Submissions Level 3
  • First Submission
  • 36 Month Streak
  • Thankful Level 5
  • Revival Level 2

View badges

Content Feed

View by

Answered
Reading a single numerical value from regexp return
Get rid of the loop and process the entire file at once. Line-by-line just makes it more complex. You can get rid of one layer ...

ongeveer 14 uur ago | 0

Answered
Finding the indexes of multiple substrings within a larger string.
idx = regexp(c,'\d\d') % no overlaps idx = regexp(c,'\d(?=\d)') % with overlaps

ongeveer 17 uur ago | 0

Answered
I don't understand what this function is doing 'Invoke'
"but what these 0, 0, 0, 0, 1, 1, 0 is doing? also that 2 at the end?" Those are inputs to some COM object's method. The method...

1 dag ago | 0

Submitted


Numeric to Ordinal-String
Convert numeric values to a string array of integers with ordinal suffixes. Fully vectorized!

2 dagen ago | 2 downloads |

Thumbnail

Answered
Why can't the index variable of a for loop be stored in a structure or other array?
"More broadly, is there some way to store index variables together?" status.loop1 = 1:10; for k = status.loop1 %do someth...

2 dagen ago | 1

Submitted


Number to Scientific Prefix
Convert a numeric value to SI-prefixed text (aka engineering / metric prefix). Bonus: binary prefixes!

2 dagen ago | 17 downloads |

Thumbnail

Submitted


Scientific Prefix to Number
Convert SI-prefixed text (aka engineering / metric prefix) into numeric values. Bonus: binary prefixes!

2 dagen ago | 9 downloads |

Thumbnail

Answered
Choosing specific column within cells
Why not just use the same loop? There does not seem to be any point in using a second loop. for k = 1:numel(C) F = fullfil...

3 dagen ago | 0

| accepted

Answered
Creating new matrices with input depending on csv filename
See: https://www.mathworks.com/help/matlab/ref/fullfile.html https://www.mathworks.com/help/matlab/import_export/process-a-sequ...

3 dagen ago | 0

| accepted

Answered
How to select specific rows of data from .mat file containing multiple column vectors
F = 'name of your mat file'; S = load(F); D = structfun(@(v)v(100:499),S, 'uni',0)

3 dagen ago | 0

Answered
count nan of different rows
S = load('TG_sshobscorr.mat'); D = S.sshobscorr; Try either of these: N = sum(~isnan(D),2) N = sum(isfinite(D),2)

4 dagen ago | 0

Answered
How to fix error with while loop?
"I keep getting the error shown below. How can I fix this? " By doing exactly what the error message tells you: move the script...

4 dagen ago | 0

Answered
when I using readtable to read .csv file all variable data get mixed, what are the reason for this and provide proper solution for this
There is no need to change the file format when you can simply specify the delimiter when importing: T = readtable('daily_cloud...

4 dagen ago | 0

| accepted

Answered
Adding Matrices into main diagonal of Matrix
"As we can see, matrix is not a 10x10 matrix with the main diagonal filled with the intended values above." After calling BLKDI...

4 dagen ago | 0

| accepted

Answered
How do I add to a structure in a for loop?
Rather than creating another variable, simply store the imported data in the same structure that you are already using. I also i...

4 dagen ago | 0

| accepted

Answered
Preallocating and filling long array with shorter arrays
The simple apparoach is to use a matrix or array, for example: N = 10; M = nan(5,N); for k = 1:N M(:,k) = rand(5,1); en...

5 dagen ago | 0

| accepted

Answered
posix/unix time to datetime
Unix time is actually defined as the number of seconds since the epoch. The times you show are the milliseconds since the epoch....

5 dagen ago | 1

| accepted

Answered
don't know how to write my for loop
The loop might be clearer iterating from 2, for example: N = 121; % total number of vectors A = rand(21,21); M = nan(21,N); ...

5 dagen ago | 0

Answered
I'd like to skip the file that's not there and bring it up!
A simple alternative approach is to use DIR: S = dir('01__input/NO_*.mat');: for k = 1:numel(S) F = fullfile(S(k).folder...

6 dagen ago | 0

Answered
convert char to table or cell
T = readtable('data.txt', 'Delimiter','|', 'VariableNamingRule','preserve')

6 dagen ago | 0

Answered
count the number a letter appears in a string and plot a histogram
V = categorical(["A","C","G","T"]); W = V(randi(4,1,23)) histogram(W)

7 dagen ago | 0

Answered
Intermediate dot indexing produced a comma-separated list with 34 values, but it must produce a single value when followed by subsequent indexing operations
The documentation https://www.mathworks.com/help/bioinfo/ref/getpdb.html#bq5gvma-2 states the the MODEL field can be a structu...

7 dagen ago | 0

| accepted

Answered
How to sort the rows of an array by the total number of zeros in the row
A = [1,0,0;2,0,0;3,0,0;0,1,0;1,1,0;2,1,0;0,2,0;1,2,0;0,3,0;0,0,1;1,0,1;2,0,1;0,1,1;1,1,1;0,2,1;0,0,2;1,0,2;0,1,2;0,0,3] [~,X] =...

7 dagen ago | 0

| accepted

Answered
Resample function is not working properly and damaging the signal
It is easy to avoid the loop too, it is just a simple linear interpolation: p = 3; q = 2; tx = (0:p:300-p).'; x = cos(2*pi*t...

7 dagen ago | 1

Answered
Count repetitions separately in an array
A = [1;1;2;2;2;2;2;2;3;1;1;1;1;4;4;4;1;1;1;5;5]; D = diff([0;A;0]==1); B = find(D>0); E = find(D<0); L = E-B X = find(L>2);...

8 dagen ago | 1

| accepted

Answered
How to combine two vectors column-by-column?
A = [1,3,5,7;9,11,13,15;17,19,21,23] B = [2,4,6,8;10,12,14,16;18,20,22,24] C = reshape(permute(cat(3,A,B),[1,3,2]),size(A,1),[...

8 dagen ago | 1

| accepted

Answered
How to obtain vector of specific values in MATLAB
M = kron(eye(16),ones(6,1)) or M = repelem(eye(16),6,1)

8 dagen ago | 2

Answered
How to set -0.0000 and 0.0000 as zero in matlab?
"Is there a way to keep zeros as zeros? " Zeros are zeros. But the data you show are not zero: the trailing digits tell us tha...

8 dagen ago | 0

| accepted

Answered
Reforming index without using loops
Verb % Create a repeating counter with values 1-12 repeating 4 times (48 values total) counter = 1:12; counter = repmat(count...

8 dagen ago | 1

| accepted

Answered
How to draw the values of a comma-separated list with 100 values?
Assuming that every field POWERH2COM contains arrays of the same size, and also that every SIM structure contains exactly the sa...

9 dagen ago | 1

| accepted

Load more