Community Profile

photo

Stephen Cobeldick


Last seen: Today
6,937 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
using a value to find index in a matrix?
The simplest solution is to simply check for equality: idx = x==Matrix_A; which will return a logical array with true in every...

9 hours ago | 0

Answered
Extract unknown number of vectors from matrix
" num2cell would create separated cells with the n vectors of size, but sub2ind also does not run on cells." True, but you can ...

10 hours ago | 0

| accepted

Answered
code to load my files from folder, add workspace variable and save to another folder
You don't need to load the file data, you can use save's '-append' option: fs = 128; for ... loop over all files, you need to ...

11 hours ago | 1

| accepted

Answered
exceeded number of array elements
Ru is scalar, but in multiple locations you try to access Ru(2), e.g.: for u = 1:2 xX{u} = @(Beta) Ru(u)*cos(Beta) + sqrt( R^2...

12 hours ago | 1

Answered
How to replace every non-0 number with the number in that place added to another number - no loops
I think it is neater to only define the index once: >> X = A~=0; >> A(X) = A(X)+B A = -6 0 -4 -3 -2 0 1 0 ...

16 hours ago | 0

Answered
Error "too many output argument" in function
"How should I do to fix the error?" If you want a function to return an output then the it must be defined in the function decl...

16 hours ago | 0

Answered
pass string variable to a function in uicontrol callback
Define the function to accept five input arguments: function correctAnswer(hCorrectAns,EventData,num1,randomVector,string1) an...

20 hours ago | 0

Answered
how do i plot til some x one function and then other
x = 0:0.1:20; y = min(12,x); plot(x,y,'-+') In a more general case, use logical indexing, e.g.: x = 0:0.1:20; y = x; y(y...

22 hours ago | 1

| accepted

Answered
Index exceeds the number of array elements (1).
Your define angulo as a scalar (i.e. size 1x1): angulo= 15; and then a few lines later with i=2 you try to access its 2nd elem...

23 hours ago | 0

| accepted

Answered
Inputting the function Sin(2x)Cos^2(0.5x)
x = linspace(0,2*pi,50); y = sin(2*x).*cos(0.5*x).^2; plot(x,y)

1 day ago | 0

Answered
Plot a variable within a function
"How should I plot Ca vs W curve after function has been evaluated" Return the required variables as the 2nd, 3rd, etc. functio...

1 day ago | 0

Answered
Invalid data type - converting to cell array to run functions
In both cases your code nests a cell array inside a cell array: dff{i} = num2cell(tot_dff(1,f_i(i):f_o(i))); % ^^^^^^...

1 day ago | 1

| accepted

Answered
Using an integral in a function
The problem is that in the "main file" you did not declare q_Max and f_1 as global. But rather than using global variables (whi...

1 day ago | 0

Answered
Doubt about plotting in Matlab and finding intersect points
"...if I plot the circle with the lines, the circle deforms to an oval" axis('equal') https://www.mathworks.com/help/matlab/re...

2 days ago | 0

| accepted

Answered
how to load saved workspace in a custom named variable?
The efficient approach is to use indexing (rather than anti-pattern dynamic variable names): https://www.mathworks.com/help/mat...

2 days ago | 1

| accepted

Answered
converting abbreviation of months to numerical value
ismember makes this easy: >> D = {'mar','apr','nov','may'}; % your data >> C = {'jan','feb','mar','apr','may','jun','jul','aug...

2 days ago | 0

Answered
how do I create a loop for to extract doubles variables from a cell array?
Where raster_data is your cell array: for k = 1:numel(filenames) raster_labels = raster_data{k}; ... the rest of your...

2 days ago | 0

| accepted

Answered
Extracting data from a table that has cells in cells
>> S(1).date = '20200120'; >> S(2).date = '20200120'; >> S(1).id = 1; >> S(2).id = 2; >> S(1).action = [0;0;0;1;0]; >> S(2)...

3 days ago | 1

| accepted

Answered
Split array of sensor data by indexing
S = load('matlab.mat'); T = S.Data.IMU; G = findgroups(T.name); C = arrayfun(@(g)T(g==G,:),1:max(G),'uni',0); You can then t...

3 days ago | 1

| accepted

Answered
What code is it?
"Is there someone recognize the following code..." It isn't code, it is a binary .mat file (just as the text at the start of th...

3 days ago | 0

Answered
store for loop outcomes in matrix
With MATLAB it is generally much better to loop over indices (rather than over data values), then you can simply use those indic...

3 days ago | 0

| accepted

Answered
Importing and Organizing Text File Data
This efficiently reads all of the file data into one structure. [fid,msg] = fopen('Example_File.txt','rt'); assert(fid>=3,msg...

3 days ago | 0

| accepted

Answered
Variable 'KD' is not fully defined on some execution paths
Look at this line of code KD_anterior=KD; and now consider what is the value of KD the second time the function is called. The...

3 days ago | 0

Answered
How to select or group sections of an array without using indexing
>> A = [NaN, NaN, NaN, NaN, 2, 3, 6, 7, NaN, NaN, NaN, NaN, NaN, 4, 6, 8, 8, NaN, NaN, NaN, NaN]; >> X = diff([true,isnan(A),tr...

3 days ago | 0

| accepted

Answered
Assign values of .mat files into matrix
D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'silomodresults*.mat')); C = {}; for k = 1:numel(S) ...

3 days ago | 0

| accepted

Answered
Splitting an array up
Just use mat2cell, no need for reshape: >> M = rand(64,92690); % fake data >> N = 2048; >> S = size(M); >> V = repmat(N,1,fi...

4 days ago | 2

Answered
Subtraction inside a cell array
You will have to get the numeric data out of the cell array before performing any numeric operations on it. Although you did no...

4 days ago | 0

Answered
How to combine the multiple .mat files of ecg to get a single file.
This should get you started: D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'*.mat')); for k = 1:nume...

4 days ago | 1

| accepted

Answered
How to apply if statement in ode45 function?
c = max(0,c);

4 days ago | 0

Load more