Community Profile

photo

Stephen Cobeldick


6,044 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
How do I call a function handle with an vector - rather than a list of arguments
Easy: first define a cell array: C = {a1Init, wG1, x1,a2, wG2, x2, c, x}; and then use a comma-separated list: fitFunctionHan...

16 hours ago | 0

Answered
Load data from mat files to a matrix
N = 50; C = cell(1,N); for k = 1:N F = sprintf('%d.mat',k); S = load(F); C{k} = S.Data(:,3); end M = [C{:}] ...

16 hours ago | 0

Answered
how to insert a value into the array in a consistent manner.
>> A = ones(3,1); >> A(end+1) = 0; >> A([2:end,1]) = A A = 0 1 1 1

21 hours ago | 0

| accepted

Answered
Code overwrites results in for loop. Cannot figure out how to index.
Either alpha_beta(k,1) = first_data(1); alpha_beta(k,2) = first_data(3); or alpha_beta(k,1:2) = first_data([1,3]); And reme...

22 hours ago | 0

Answered
Index exceeds the number of array elements (35).
You have repeatedly used syntax with an = sign, which assigns those values to some variables, e.g: xlabel=('estimated time--->'...

2 days ago | 0

Answered
Understanding Figure Windows & Changing Their Apperances
"Why cannot i amend the Number property?" Because the 'Number' property is read only: https://www.mathworks.com/help/matlab/re...

4 days ago | 0

| accepted

Answered
how can improve the performance
maxval = max(maxval,myArray(1:count,2))

4 days ago | 0

Answered
How do I change the values of rows in specific columns based on another table which serves as a lookup?
>> A = [2001,2001;2001,2003;2001,2005;2001,2006] A = 2001 2001 2001 2003 2001 2005 2001 2006 >> B = [1...

5 days ago | 0

| accepted

Answered
How do I locate all integer values within a matrix (of string and integer values in the same cell), then replace all those integer values with a 1 or 0 thus forming a new matrix with the replaced integers?
Method one: multiple regular expressions in one regexprep call: >> c = {'( x(2) | x(1) )', 'x(3)', '( x(4) | x(6) | x(5) )', '(...

7 days ago | 1

Answered
Averaging 30 arrays into one using function
Do not create lots of separate variables or arrays, just use the split-apply process: https://www.mathworks.com/help/matlab/mat...

7 days ago | 0

Answered
Dont know how to name this...
MATLAB only accepts decimal point , and does NOT accept a decimal comma. When you write a comma you are writing two separate va...

7 days ago | 1

| accepted

Answered
Please help me to understand Error "The expression to the left of the equals sign is not a valid target for an assignment.
The problem is your invented syntax using { and }, which looks like you are trying to write code using a different programming l...

8 days ago | 2

| accepted

Answered
How to read specific parts of file and then write it to a text file?
This imports all of the "TEC MAP" data from the file you uploaded: str = fileread('codg1520.14i'); % Functions to convert text...

8 days ago | 0

| accepted

Submitted


MatPlotLib Perceptually Uniform Colormaps
MatPlotLib's default perceptually uniform colormap VIRIDIS and distinctive ColorOrder TAB10/VEGA10

8 days ago | 69 downloads |

Thumbnail

Answered
Minimum value of loop
>> N = 3; >> a = Inf; >> for k = 1:N, a = min(a,k+2); end >> a a = 3

9 days ago | 0

| accepted

Answered
How to concatenate all these cells vertically?
>> load('matlab.mat') >> R = S.result; >> T = vertcat(R{:}); >> whos T Name Size Bytes Class Attr...

9 days ago | 1

| accepted

Answered
Creating a tridiagonal matrix
"My teacher has said that the best way to go about it is using loops" Why on earth would they say that? Either diag : >> N = 1...

10 days ago | 1

Answered
split a string by a set of pre-defined number of characters rather than any delimiter
You could do that using regular expressions: >> S1 = ' 961.666 - Psat 1.0000 45.0971 3.6734';...

13 days ago | 0

| accepted

Answered
removing non prime number function
str = fileread('temp.txt'); vec = str2double(regexp(str,'\d+','match')) [fid,msg] = fopen('output.txt','wt'); assert(fid>=3,m...

13 days ago | 0

Answered
Repeat the value of a variable to match the length of another variable
>> X = 'TESTING'; >> Y = 'WORLD'; >> Z = Y(1+mod(0:numel(X)-1,numel(Y))) Z = WORLDWO

13 days ago | 0

Answered
Substract Matrix coloum-wise from Matrix without using a loop
permute lets you do this on one line: D = min(sqrt(sum(bsxfun(@minus,permute(A,[1,3,2]),permute(B,[3,1,2])).^2,3)),[],1); And ...

14 days ago | 0

| accepted

Answered
Is MATLAB confusing functions and arrays?
"Is MATLAB confusing functions and arrays?" That can happen in certain circumstances, but that does not seem to be the case her...

14 days ago | 1

| accepted

Answered
Storing user inputs during while loop, in a vector
x = []; while ... x(end+1) = input(prompt); end

15 days ago | 0

Answered
find elements vector in a matrix
Simply use sub2ind like this: >> idx = sub2ind(size(psic_pos),1:size(psic_pos,1),loc); >> vec = psic_pos(idx) vec = 0....

16 days ago | 1

| accepted

Answered
find 4d matrix positions
"I tried with ind2sub but it was useless." It worked for me. First lets define some fake data: >> A = zeros(5,4,3,2); >> A(5,...

16 days ago | 0

| accepted

Answered
import data without header
opt = {'HeaderLines',20}; fmt = repmat('%f',1,4); str = fileread('temp0.txt'); C = textscan(strrep(str,',','.'),fmt,opt{:}); ...

16 days ago | 0

| accepted

Answered
Extract number from file name
>> C = {'K10_0.0.json', 'Mig_Thresh_2.0.json', 'K_5_6.5.json', 'WC_0.00051.json'}; >> [~,N] = cellfun(@fileparts,C,'uni',0); >...

16 days ago | 1

Answered
Switch function to output number of days in a month
Actually you need to use the optional 's' argument for input, otherwise your code will throw an error: n = input('Enter the mon...

17 days ago | 0

| accepted

Answered
How to solve Reference to non-existent field 'folder'.
The folder field (and recursive folder searching) was added in R2016b. As you are not using the recursive folder search you can...

17 days ago | 0

| accepted

Answered
Sort the dir loaded files
Download my FEX submission natsortfiles and follow the examples in its documentation: https://www.mathworks.com/matlabcentral/f...

19 days ago | 0

Load more