Community Profile

photo

Stephen Cobeldick


5,726 total contributions since 2014

Suspensa Vix Via Fit

Stephen Cobeldick's Badges

  • Master
  • 36 Month Streak
  • Thankful Level 4
  • Revival Level 2
  • Knowledgeable Level 4
  • First Answer

View details...

Contributions in
View by

Answered
How can I import repeating blocks of mixed data as a table?
This imports and parses your example file: str = fileread('Data.txt'); str = regexprep(str,{'= ','[\r\n]+SNC','[\r\n]+'...

1 day ago | 2

| accepted

Answered
How to illustrate a cell array
There are no doubt many ways of doing this, one relatively intuitive way would be to use scatter. This should get you started (b...

3 days ago | 1

| accepted

Answered
How do I use sprintf with two variables with different sizes?
Assuming that you have nested structures, then you can easily do something like this: >> s(1).rawdata.data00 = 100; >> s(1).ra...

3 days ago | 0

| accepted

Answered
Color and brightness in imread
Your image is actually an indexed image, not a grayscale image, and this is easy to find out using the inbuilt imfinfo: >> imfi...

3 days ago | 0

| accepted

Answered
How to remove everything from string except what's inside square brackets?
Where C is your cell array: >> D = regexp(C,'\[(.+)\]','tokens','once') >> D = vertcat(D{:}) D = 'rpm' 'rpm' ...

7 days ago | 0

Answered
Exponent on top or on the right of the axis, control, turn off?
Either set the number format or the exponent: https://www.mathworks.com/help/matlab/creating_plots/change-tick-marks-and-tick-l...

7 days ago | 1

| accepted

Answered
ismember(A,B,'rows') indexing
>> one = {'ADSµSOIC8';'AVX0603';'ELN';'ELNH10';'EPC';'EPC0603';'FAGDO214AA';'FAGDO214AA (SMB)';'FAGDO214AB';'FAGDO214AC';'FAGSMA...

8 days ago | 1

| accepted

Answered
How can I make a single plot that consists of multiple lines, each made from every n rows of a vector?
"I'm sure I will need to use a loop because I won't be able to do this manually for a 300,000 x 2 set of data." I don't see why...

9 days ago | 0

| accepted

Answered
logaritmical spacing / incremented spacing
>> diff(fix(log2((1:32).'))) ans = 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 ...

10 days ago | 1

| accepted

Answered
Transferring data from a cell array to a vector
"can i convert this data into vector?" >> Atlas = {122,12} ; >> vec = [Atlas{:}] vec = 122 12 https://www.mathworks.c...

10 days ago | 0

Answered
Split string into string based on character type
>> S = '1A2'; >> C = regexp(S,'(\d+)(\D+)(\d+)','tokens','once') C = '1' 'A' '2'

10 days ago | 0

| accepted

Answered
How to append cell arrays with a very specific form
As long as your data meet some assumptions: each group contains exactly the same number of rows (four in your example), and ea...

10 days ago | 1

| accepted

Answered
Execute code faster for saving files with a matrix
"Any ideas how to run faster my code" Don't use xlswrite to write text files! Do not convert between data classes (e.g. do not...

10 days ago | 0

| accepted

Answered
Unexpected for loop behaviour
"Unexpected for loop behaviour" The value -0.1 cannot be represented exactly using floating point numbers, and you could quite ...

10 days ago | 1

| accepted

Answered
random numbers without repetition of two consecutive numbers
Adapting John D'Errico's answer to an earlier question: >> n = 5; >> k = 4; >> t = 100; >> 1+mod(cumsum([randi(k,t,1),randi(...

11 days ago | 4

Answered
Finding length of a struct, excluding NaN values
You can do this very easily with the accepted answer to your very similar question from two months ago: https://www.mathworks.c...

11 days ago | 2

| accepted

Answered
How to Overwrite Data
One simple MATLAB way: C = max(A,B).*(B~=0) Or for MATLAB versions prior to R2016b: C = bsxfun(@max,A,B).*(B~=0)

11 days ago | 0

| accepted

Answered
Does findpeaks work with mat files?
Most likely you need to actually refer to the structure that you imported the file data into: S = load('mytrace2131soma&syns.ma...

13 days ago | 0

Answered
Read only numbers from string
"Given a string, how to read only the numbers?" That really depends on what you define as being a "numberˇ: which of these are ...

13 days ago | 0

| accepted

Answered
help to use for loop in four layer
Without loops: >> [X,Y,Z] = ndgrid(1:3); >> A = permute(cat(3,p(:,Z),ommega(:,Y),v(:,X)),[1,3,2]); And checking with some exa...

13 days ago | 1

| accepted

Answered
Putting Consecutive numbers into variables
>> A = [1;2;3;7;0;6;7;8;9;2;4;3;14;15;16;17;0;9;2]; >> D = diff([false;diff(A(:))==1;false]); >> F = @(b,e)A(b:e); >> C = arr...

14 days ago | 0

| accepted

Submitted


Maximally Distinct Color Generator
Generate truly maximally distinct colors in an RGB colormap.

14 days ago | 21 downloads |

Thumbnail

Submitted


Convert between RGB and Color Names
RGB to color name. Color name to RGB. Palettes: CSS, HTML, MATLAB, SVG, X11, xcolor, xkcd,...

15 days ago | 23 downloads |

Thumbnail

Answered
Meet multiple conditions (or)
Use ismember: ismember(peroxi_3d_lab,your_conditions_array) Tip: with MATLAB it is always important to think in terms of opera...

15 days ago | 0

| accepted

Answered
Use one matrix to change values of another
Method one: indexing: >> X = ismember(B,A) >> B(~X) = 0 B = 1 2 3 4 0 0 0 0 1 2 ...

15 days ago | 1

| accepted

Answered
regex: Extract then delete
"Is there a regex function that can extract matched strings and delete them after?" Not really. You could do something like th...

15 days ago | 0

| accepted

Answered
Using a matrix as pairs of indexes of another matrix
"How can this be done without a loop?" Using sub2ind, which converts to linear indices: >> ind = sub2ind(size(x),idx(:,1),idx(...

15 days ago | 0

| accepted

Load more