Community Profile

# Stephen Cobeldick

##### Last seen: Today
6,186 2014 이후 총 참여 횟수

Suspensa Vix Via Fit

#### Stephen Cobeldick's 배지

세부 정보 보기...

참여 게시물
보기 기준

답변 있음
How to use a vector to index another vector?
That function output is rather fragile, as there is no way to distinguish zeros (data) from zeros (place holders). This could ea...

약 7시간 전 | 0

답변 있음
Shor Algorithm for prime factoring

약 7시간 전 | 1

| 수락됨

답변 있음
find the nearest values
You were almost there, you just need to use the second output from min to make it easier: >> A = rand(1,2) A = 0.39011 0...

약 17시간 전 | 1

| 수락됨

답변 있음
Selecting min value per row unless min value is repeated in another row.
Set the duplicate values to Inf/NaN, take the minimum of each row, then remove the Inf/NaN values: >> A = [1,2;1,3;2,3;5,6;3,7;...

약 21시간 전 | 0

답변 있음
Using a string shortcut for nested structure
For accessing a field of one specific structure (which can be nested) you should use dynamic fieldnames: https://www.mathworks....

1일 전 | 1

| 수락됨

답변 있음
How to save the result of stlwrite to a specific directory chosen by the user
TR = ... [F,P] = uiputfile('*.stl'); stlwrite(TR,fullfile(P,F))

1일 전 | 0

답변 있음
While loop not starting
Lets have a look at the first y value: >> f = @(x) 4*x^2 - 3; >> x(1) = 0.5; >> y(1) = f(x(1)) y = -2 And now look at your ...

2일 전 | 1

| 수락됨

답변 있음
FSOLVE requires all values returned by functions to be of data type double
The function handle definition is incorrect: @(B)@ourfun What you defined is an anonymous function which when called accepts o...

3일 전 | 1

| 수락됨

답변 있음
Indexing with two matrices
>> [C,~] = find(bsxfun(@eq,permute(A,[1,3,2]),permute(B,[3,1,2]))); >> C = reshape(C,size(B)) C = 2 1 2 4 3 4

3일 전 | 0

답변 있음
How to search through entirety of one field of a structure
The general solution is to use comma-separated lists: https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.h...

4일 전 | 0

답변 있음
Importing data with unequal number of column
This is very simple and efficient using fscanf: [fid,msg] = fopen('Data.txt','rt'); assert(fid>=3,msg) mat = fscanf(fid,'%f',...

4일 전 | 1

| 수락됨

답변 있음
Extracting second number after comma within parenthesis
Simply match all text from the comma to the whitespace: >> str = 'Toc(Clock Data Ref Time) : 0x91E6 (37350,5.976000e+005 s...

4일 전 | 0

답변 있음
Using strcmp with multiple inputs
You could use strfind or a regular expression to help you, e.g.: >> ixc = cellfun(@ischar,rw(:,3)); >> ixc(ixc) = ~cellfun('is...

5일 전 | 0

| 수락됨

답변 있음
declaring a new table
For historic and compatibility reasons if the variable does not exist before the dot-indexing allocates to it, then MATLAB will ...

5일 전 | 0

답변 있음
How to convert these char values to datetime format?
The error is caused by the milliseconds in start string: either you need to remove them from the input string, or specify them i...

5일 전 | 1

| 수락됨

답변 있음
Trying to modify a vector by removing alternate elements
There is no point in defining n when it always has exactly the same value as the loop iteration variable i. Get rid of one of th...

6일 전 | 1

| 수락됨

답변 있음
How to solve pre-allocating array?
Using numbered variables is a sign that you are doing something wrong. Accessing numbered variables is one way that beginners f...

6일 전 | 1

| 수락됨

답변 있음
How to pass a matrix (m, 1) to (m / 2.2)
>> reshape(V,2,[]).' ans = 1 2 3 4 5 6

8일 전 | 1

| 수락됨

답변 있음
How to generate 1 cross zero structure in Matlab??
B = reshape(A,1,0)

9일 전 | 1

| 수락됨

답변 있음
How to call a created function in a different function
Download my FEX submission num2ordinal and use it together with func2str: function out = myNewFunc(fun) val = str2double(regex...

11일 전 | 0

| 수락됨

답변 있음
flip an array with the use of vectors
"Any suggestions?" Use indexing (which in MATLAB starts from 1): >> a = [1,7,5,9,3,2,4,1] a = 1 7 5 9 3 2 4 ...

12일 전 | 0

| 수락됨

답변 있음
Using Read Table with a predefined Table size
Accessing files via the OS is slow, note that creating an intermediate file requires accessing a file minimum three times. A sim...

13일 전 | 1

답변 있음
How can I dynamically index into a nested struct that contains cell arrays
Essentially you are attempting to write a MATLAB parser using MATLAB. Such a task is not trivial, but for a very limited subset ...

13일 전 | 0

| 수락됨

답변 있음
How can I delete two or more elements in a vector?
>> A = [1,1,2,3,10,7,10,1,5,3]; >> U = unique(A); >> Z = U(histc(A,U)==1) Z = 2 5 7

14일 전 | 1

| 수락됨

답변 있음
inputs of multi-variable functions?
"Is there a right order for input variables in a function?" Yes: MATLAB function inputs are positional: The 1st input provided...

14일 전 | 0

| 수락됨

답변 있음
how to rearrange cell array with the grouped sequence
>> C = {21,3,'1';31,2,'1 1';25,1,'2 2 1 1'} C = [21] [3] '1' [31] [2] '1 1' [25] [1] ...

14일 전 | 0

답변 있음
How to simplify code which reads multiple files
You don't need to repeat the entire code, just the dir call is enough: theFiles = [... dir(fullfile(myFolder, '*ABC*.csv')...

14일 전 | 0

| 수락됨

답변 있음
imshow not working when going from unit8 to double
Most likely because you did not scale the image when you converted the type. uint8 images are treated as having values from 0 t...

15일 전 | 0

| 수락됨

답변 있음
Looping a function with different inputs and storing multiple outputs.
The very simple solution is to loop over indices, and not over data (like you are doing): V1 = 0.5:1:2.5; % data! V2 = 0.5:1:2...

15일 전 | 1

| 수락됨

답변 있음
Save and Load .mat files with different names that numerically go up automatically. Maybe in a for loop?
"...as long as there is a way to load multiple of these in one go, without them all overwriting each other as fvalagg" This is ...

15일 전 | 1

| 수락됨