Community Profile

photo

Stephen Cobeldick


Last seen: Today
6,717 total contributions since 2014

Suspensa Vix Via Fit

Stephen Cobeldick's Badges

  • Personal Best Downloads Level 4
  • Editor's Pick
  • First Review
  • 5-Star Galaxy Level 5
  • GitHub Submissions Level 3
  • First Submission
  • Master
  • 36 Month Streak
  • Thankful Level 4
  • Revival Level 2
  • Knowledgeable Level 4
  • First Answer

View details...

Contributions in
View by

Answered
Identify first and last indicies of numbers in an array containing NaN's
Your original idea of using diff is exactly the simple and efficient solution that experienced MATLAB users would use: >> M = [...

21 hours ago | 0

Answered
How to parse text to numbers?
>> ttxt = {'No info';'1-50.00000';'3-100.000';'2-2.0000';'Free & Unlimited';'1-100.0000;1-0.0000';'1-25.000;1-50.000'} ttxt = ...

1 day ago | 1

| accepted

Answered
Separate string with tag_string
This should get you started. Adjust as required. str = 'tag_A(this is tag A, it contains tag_B(this is tag_B, it contains tag_C...

2 days ago | 0

| accepted

Answered
Hi, this function is to return the maximum value of 'n' consecutive elements but error index exceeds the number of array elements appears for a random applied vector
The main bug is that you are iterating over data values and not indices as your code requires. On this line you define the loop ...

2 days ago | 0

Answered
Count number of indexes for each consecutive values in column of array
>> V = [0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0]; >> D = diff([0;V(:);0]); >> find(D<0)-find(D>0) ans = 3 9

4 days ago | 0

| accepted

Answered
What should I do to display midnight in datetime?
>> dt = datetime(2019,9,8,0,0,0,'Format','yyyy-MM-dd HH:mm:ss') dt = 2019-09-08 00:00:00

4 days ago | 0

Answered
How can I writetable to cell array
Where C is your cell array: for k = 1:numel(C) F = sprintf('file_%d.CSV',k); writetable(C{k},F) end This just follo...

7 days ago | 0

| accepted

Answered
Dynamic vectors into cell
It is very easy to get what you want, you just need to avoid concatenating all of the numeric/logical data together, e.g.: >> D...

7 days ago | 0

| accepted

Answered
Using cellfun and regexp question
The simple and efficient solution is to use the 'once' option: sampleRates = regexp(storedSamplerates,'\d+','match','once'); %...

7 days ago | 1

Answered
How to remove array items that include a certain substring?
>> C = {'a1','a2','b1','b2','c1','c2'}; >> X = strncmpi(C,'c',1); >> D = C(X) D = 'c1' 'c2'

7 days ago | 0

Answered
what is the best possible way to find the missing values using interpolation
>> a60 = [1,5,9,13,17,21]; >> t60 = 60*(0:numel(a60)-1); >> t15 = t60(1):15:t60(end); >> a15 = interp1(t60,a60,t15) a15 = ...

8 days ago | 0

Answered
convert period (.) to colon (:) for reading time
I don't see why you need to convert any characters, MATLAB imports that format without error: >> str = '2020-07-29 14.42.32'; ...

8 days ago | 1

Answered
how to remove rows and columns in cell array ?
Where C is your cell array: C(25419:29317,:) = []; You could also detect those rows automatically: X = all(cellfun(@isempty,C...

9 days ago | 1

Answered
Passing variable from anonymous objective function to main workspace
You can do this easily with nargin: function val = objfun(x,v1,v2) persistent data if ~nargin val = data; return e...

9 days ago | 0

Answered
complex repeating input format
fmt = repmat('%f%s%s%s%s',1,97); fmt = ['%s%f%f%f%f%s',fmt]; Note that you wrote "First 5 columns..." but your example format ...

9 days ago | 1

| accepted

Answered
Convert a fixed width char array into a column vector
This will be quite efficient: >> aa = ' 1703434 42 1012275140184521401845314018473'; >> vec = sscanf(sprintf('%c%c%c%c%c%...

9 days ago | 1

Answered
convert 1x1 Cell with scientific number as text to a number in MATLAB.
Just use the correct indexing for accessing the contents of a cell array: E1 = T{1,2}; https://www.mathworks.com/help/matlab/m...

9 days ago | 0

| accepted

Answered
Callback Push Button Execution
"...and to me I originally thought one of these two should have happened..." What actually occurs is described in the MATLAB do...

11 days ago | 0

Answered
Converting a 2d matrix into a 3d matrix
Depending on how you want them arranged in the new array, either test1 = reshape(test,4,6,10); or test1 = permute(reshape(tes...

11 days ago | 0

| accepted

Answered
Error: EXTRAPVAL must be a scalar
According to the interp2 documentation, the extrapval must be a scalar numeric: https://www.mathworks.com/help/matlab/ref/inter...

11 days ago | 0

| accepted

Answered
Extract a column of a matrix created by a command
MATLAB does not generally support indexing** directly into the output of functions or operations. The usual solution is to alloc...

11 days ago | 0

Answered
vertically concatenate struct values from the same field
V = vertcat(S1.vals) V = vertcat(S1(1:10).vals) https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html ...

11 days ago | 0

| accepted

Answered
Using fprintf to display multiple strings
Very simply add an identifier to the format specifier: fprintf('%1$s + %1$s',char(955)) % ^^ ^^ input...

11 days ago | 0

Answered
imshow() black for max value and white for min value?
Assuming that the image array A contains values in the range 0-1: imshow(1-A)

15 days ago | 0

| accepted

Answered
How to accelerate the process of `find` in large for loop ?
>> [X,Y] = ismember(A,B); >> [~,Z] = sort(Y(X)); >> V = find(X); >> R = reshape(V(Z),2,[]).' R = 2 9 4 8 5 ...

16 days ago | 0

| accepted

Answered
Storing integers from a cell in a variable
Much more efficient than cellfun: >> C = {'(4,4)';'(3,4)';'(2,4)';'(1,4)';'(0,4)';'(-1,4)';'(-2,4)'}; >> V = sscanf([C{:}],'(%...

16 days ago | 1

| accepted

Answered
Unable to perform assignment with 0 elements on the right-hand side.
The actual problem is that you think that one (or more) of these values match: app.AccelSNEditField == mergetables{:,1} In fac...

17 days ago | 1

Answered
Error with Uniquetol: " Repetitive numbers not being removed"
Set the tolerance to a suitable value, e.g.: >> uniquetol(GlobalNMesh,1e-3) ans = 0 0.0336 0.1199 0.1331

18 days ago | 0

| accepted

Answered
Combining matrices from workspace or from directory into a single matrix.
Assuming that each .mat file contains exactly one array with compatible sizes: D = 'path to the directory where the files are s...

20 days ago | 1

| accepted

Answered
mapping of datas in -pi to pi to 0 to 2*pi
mod(data,2*pi)

21 days ago | 0

Load more