Community Profile

photo

Stephen Cobeldick


5,518 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
Double Precision is rounding at the 5th digit?
Change the display format., e.g. format long g Although beginners often confuse the two, how data is stored in memory and how ...

3 hours ago | 3

| accepted

Answered
two column vector division
"two column vector division" All of your examples use row vectors, not column vectors. "What is a mathematical formula?" See ...

4 hours ago | 1

Answered
How does the function contains behave ??
The contains function behaves exactly as I would expect, based on its documentation, which states "If pattern is an array contai...

14 hours ago | 0

| accepted

Answered
Adding elements of double arrays inside cell array below another double array inside the same cell array
Concatenating the contents of a cell array is easy using a comma-separated list: >> A1 = cat(1,Sort{1,:}) A1 = 1 2 ...

1 day ago | 0

Answered
Index exceeds number of array elements?
On each loop iteration the loop iterator variable R_e is scalar (i.e. it has size 1x1). Inside the function you define i=1 and t...

1 day ago | 0

Answered
Conversion of multidimensional cell into string
Using Guillaume's cell array defined above: >> C(:,2) = cellfun(@(v)char(v+'0'),C(:,2),'uni',0) C = 2 '010' 73 '01...

1 day ago | 1

| accepted

Answered
Load multiple struct 1x1 mat files
It is recommended to load into an output variable, rather than directly into the workspace. doing so also makes your task simple...

1 day ago | 0

Answered
A command like "unique" for matrices?
A general solution that does not concatenate the data and works for any size arrays: % Fake data: A = [1;2;3]; B = [1;2;3]; ...

1 day ago | 1

| accepted

Answered
How can i seperate a string in all possible smaller ones without using for loops;.
>> a = 'ATGCA'; >> n = 2; >> x = hankel(1:n,n:numel(a)).'; >> b = num2cell(a(x),2) b = 'AT' 'TG' 'GC' 'CA'

1 day ago | 1

| accepted

Answered
Function day not working
''Unable to use a value of type 'datetime' as an index.'" That error message makes it quite clear: you have a variable in the w...

1 day ago | 0

| accepted

Answered
Convert cell arrays to 4-D array
Where C is your cell array: M = cell2mat(permute(C,[4,3,2,1]))

2 days ago | 0

Answered
C-order reshape of multi-dimensional array in matlab
This gives exactly the order that you requested in your question: >> M = [1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16]; >> Z = perm...

2 days ago | 0

Answered
Simultaneous Changing of Values in For Loop.
Usually it is much easier to increment over indices, not data: t0 = 0; t = t0; Iv = 1:1:3; Jv = 2:1:4; for x = 1:numel(Iv)...

3 days ago | 0

| accepted

Answered
fprintf command output and extra output
You used the wrong operator. If you want to print to string, use sprintf. "Where is the output=15 coming from..." The fprintf ...

3 days ago | 0

| accepted

Answered
how to remove the repetitive elements from a structure
Data: >> a = struct('position', {[200 300 1],[300 200 1],[250 250 0.5],[230 280 0.6],[300 200 1],[270 150 1]}, 'cost', {[50;90]...

4 days ago | 0

Answered
Help with nested structure
This would be much easier if you had designed your data better. In particular, rather than using nested structures (which are r...

5 days ago | 0

| accepted

Answered
While loop with for loop problem
Perhaps you meant something like this: D = [3 0 0; 0 2 0; 0 0 1]; b = [0; 1; 0]; L = [0 0 0; 1 0 0; 0 1 0]; U = [0 1 0; 0 0 ...

5 days ago | 1

| accepted

Answered
Opening mat files with uiopen and copying data to array
It seems that whoever created those .mat files unfortunately named each structure with the same name as the filename, which just...

6 days ago | 0

| accepted

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Slow The MATLAB documentation Alternatives to the eval Function explains that code that uses eval is slower because "MATLAB® co...

7 days ago | 7

Answered
How do I extract the same field from diferent struct files with names like AAA_1, AAA_2... AAA_n?
I suspect that ScanImage is badly written and saves variables (e.g. structures) with a different name in each .mat file. This ma...

7 days ago | 1

| accepted

Answered
Average of several (different, across) structures
Fake data in scalar structures: S1 = struct('A',randi(99,4,3,2),'B',randi(99,4,3,2)); S2 = struct('A',randi(99,4,3,2),'B',rand...

7 days ago | 0

Answered
Keeping record of Number of concatenated files
Inside your loop: N = ... the total number of files. C = cell(1,N) for k = 1:N M = ... import the matrix here. M(:,...

7 days ago | 0

Answered
Adding certain 'parts' of two matrices
B(2:3,2:3) = A

7 days ago | 0

| accepted

Answered
How to find out whether there is a repetitive element in the columns of a matrix?
"I just want to know whether there is or not." >> any(diff(sort(a,1),1)==0,1) ans = 1 1 0

7 days ago | 2

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Alternative: save the Fields of a Scalar Structure The save command has an option for saving the fields of a scalar structure a...

8 days ago | 0

Answered
TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Alternative: load into a Structure, not into the Workspace In almost all cases where data is imported programmatically (i.e. no...

8 days ago | 5

Question


TUTORIAL: Why Variables Should Not Be Named Dynamically (eval)
Sometimes beginners (and some self-taught professors) think it would be a good idea to dynamically create or access variable nam...

8 days ago | 18 answers | 30

18

answers

Answered
Finding arrays above threshold value
Fake data: AT(1).AX = rand(1,370); AT(2).AX = rand(1,1007); AT(3).AX = rand(1,3957); AT(4).AX = rand(1,6309); AT(5).AX = ra...

8 days ago | 1

| accepted

Answered
How to Convert a column with Char in Cell matrice to Number?
You almost got it right, you just need to split the numeric array into a cell array so that it can be allocated back to the cell...

8 days ago | 0

Answered
Could anyone help me how to solve the issue.
Using very basic MATLAB indexing: A = {[1,2],[3,4],[7,5,6]}; N = numel(A); Z = nan(1,N); for k = 1:N Z(k) ... your code...

9 days ago | 0

| accepted

Load more