Community Profile

photo

Stephen Cobeldick


5,796 2014 年以降の合計貢献数

Suspensa Vix Via Fit

Stephen Cobeldick's バッジ

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

詳細を表示...

貢献した分野
表示方法

回答済み
filter string in the string
>> str = 'this matlab is a good software, it is a version 9.4 which is equal to 2018a'; >> out = regexp(str,'\d+\.\d+','match'...

8分 前 | 0

回答済み
Store results of for loop in matrix
Use a cell array: N = numel(ab); out = cell(1,N); % preallocate cell array. for k = 1:N ... your code out{k} = Ncel...

約21時間 前 | 0

| 採用済み

回答済み
How to pass Options as an argument in quadprog
x = quadprog(H,f,[],[],[],[],[],[],[],options)

約22時間 前 | 0

| 採用済み

回答済み
convert string of numbers to double
More efficient than converting to symbolic and probably also str2num: >> S = '676, 933, 1645, 2069:.025:2069.5, 2327:.025:2327....

約22時間 前 | 0

回答済み
How to create new file in another folder?
" But I have create the new file in another folder . How can I do this?" All MATLAB functions that read/write to data files acc...

1日 前 | 1

| 採用済み

回答済み
how to load a variable in a loop
D = dir('CC*/Rest/ROI_epi.mat'); for k = 1:numel(D) F = fullfile(D(k).folder,D(k).name); S = load(F); ROI = S.RO...

1日 前 | 0

回答済み
Why use x=load('myFile.mat')?
From the discussion following this answer: "why should people never ever load mat files into the workspace?" Because load-ing ...

1日 前 | 1

回答済み
Increasing number of points in a plot without ruining the shape
Try using method spline or pchip and see if they do what you want: interp1(...,'pchip') https://www.mathworks.com/help/matlab/...

1日 前 | 0

回答済み
Testing if an input is numeric or character
if isnan(Sbase_gerador) ... end

1日 前 | 0

| 採用済み

回答済み
how to call different functions of a matlab file to another matlab file
Local functions are only visible to other functions within the same M-file: https://www.mathworks.com/help/matlab/matlab_prog/l...

3日 前 | 0

回答済み
saving for loop results not working
"Can anyone please explain to me what im doing wrong and how to fix it." Your first code does not store/allocate/sum the output...

3日 前 | 0

回答済み
lsqcurvefit Error using /
Replacing both of the mrdivide operators with rdivide operators gets rid of the error: >> fun = @(x,xd) (x(1)*(1+(sqrt(1+xd./x(...

3日 前 | 0

| 採用済み

回答済み
Find mean of rows containing decimal numbers in between integers in a column
>> Y = [1,0.098,0.00076,0.01,2,0.099,0.007,2,0.003,0.04,0.1,4]; >> X = cumsum([1;diff(~mod(Y(:),1))]~=0); >> Z = accumarray(X(...

3日 前 | 4

回答済み
How to set constraints of griddata results are all non-negative?
"Is there any way to control the range of interpolation results?" You could simply adjust the output data yourself: A = max(0,...

3日 前 | 0

| 採用済み

回答済み
fopen does not work when put text code
You are adding extra single quotes, here: lgttext = (".lgt'"); % ^ superfluous Roriginaltitle = insertBefore(sp...

4日 前 | 3

回答済み
How do I change a function name within a loop using variables?
You can store function handles in a cell array and use indexing: >> C = {@(x)2*x+3,@(x)sqrt(x)+1}; % {1st fun,2nd fun} >> C{1}...

4日 前 | 2

| 採用済み

回答済み
How to split an array by same length and make a matrix?
>> a = 1:72; >> b = reshape(a,24,[]).' b = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...

4日 前 | 1

| 採用済み

回答済み
Having trouble changing mouse cursor to "watch" to indicate that function is busy.
This worked for me: set(gcf, 'Pointer','watch') drawnow() % <- you need this ... set(gcf, 'pointer','arrow') Note that the ...

5日 前 | 0

| 採用済み

回答済み
Interpolating linearly between many values in a vector
>> t_old = 1:10; % times 1:N >> rate = 1000; % 1 kHz >> t_new = linspace(t_old(1),t_old(end),(numel(t_old)-1)*rate+1);

5日 前 | 0

回答済み
How to check if one of output variables is not called
You can use nargout to detect how many output arguments are requested: if nargout>0 varargout{1} = x+y; end if nargout>1...

5日 前 | 0

| 採用済み

回答済み
I have multiple equations that depend on a specific value and would like matlab to ask the user which equation to use and what the specific value is and then print that value but it's giving me trouble.
Your code is mixed up with the (meta-)data (i.e. the variable names named as material types), which is a very bad practice and s...

5日 前 | 0

回答済み
cprintf not work in linux command window
"open a command window in Linux system" cprintf works in the MATLAB Command Window: https://www.mathworks.com/help/matlab/ref/...

5日 前 | 0

| 採用済み

回答済み
Interrupting a Callback with a Push Button
" Is there another trick you recommend for this issue" The simplest solution is to use nested functions: simply define a logica...

5日 前 | 0

回答済み
Conversion to cell from double is not possible
A = cell2mat(dataC(:,1)); B = A * pi * 2; dataC(:,3) = num2cell(B); % <- you need NUM2CELL!

5日 前 | 1

| 採用済み

回答済み
remove row of matrix inside cell
You could use cellfun like this: >> F = @(m,x) m(setdiff(1:size(m,1),x),:); >> C = cellfun(F,A,B,'uni',0); >> C{:} ans = ...

5日 前 | 0

| 採用済み

回答済み
Writing table variables with quotations marks ("Placeholder variable name")
'QuoteStrings',true https://www.mathworks.com/help/matlab/ref/writetable.html#btyc9ne-1_sep_btyc9ne-1-QuoteStrings Otherwise i...

6日 前 | 1

回答済み
Taking out entries of a Vector to make a new Vector
Where V is your vector: X = V(4:4:end); Y = V; Y(4:4:end) = [];

10日 前 | 0

| 採用済み

回答済み
automatically filling a matrix
Method one: eye and kron: >> n = 5; >> j = 6; >> M = kron(-eye(j),ones(n,1)) M = -1 0 0 0 0 0 ...

12日 前 | 0

| 採用済み

回答済み
Looping within a structure
You can easily loop over the fieldnames: F = fieldnames(mystruct); for k = 1:numel(F) A = mystruct.(F{k}); ... do wh...

12日 前 | 0

| 採用済み

回答済み
How to convert a structure array into vector
S(1).F1 = [1,2,3,4,5]; S(2).F1 = [10,20]; S(1).F2 = [2,4,6,8,10]; S(2).F2 = [150,200]; F = fieldnames(S); C = num2cell(stru...

12日 前 | 1

| 採用済み

Load more