Answered
How to set Variable-step in ODE15s?
_"Yes, the two curves look the same_" Because they are the same, within the precision of the solver and for the steps that yo...

8 years ago | 1

| accepted

Answered
Opening folders and read its information
This should get you started: D = 'C:\Deterministic\New Objectives'; S = dir(fullfile(D,'Normal_4000*')); N = {S([S.is...

8 years ago | 0

| accepted

Answered
How to create a surface plot from three variables?
If you cannot use |meshgrid| and do not have gridded data, then the easiest solution is to create three vectors (X, Y, Z), creat...

8 years ago | 1

Answered
How to use imshow with a structure ?
S = getframe(...) imshow(S.cdata) % for TrueColor image (RGB). imshow(S.cdata, S.colormap) % for indexed image.

8 years ago | 0

| accepted

Answered
remove a struct field that its element value is less than specific 50
If you want to remove elements of the structure use logical indexing: Faces = cellfun('length', {CClower.faces}); CClowe...

8 years ago | 0

Answered
Inverse of sorting arrangement
Assuming that A is a vector: [B,I] = sort(A); [~,J] = sort(I); B(J) If you have a matrix/array, then you first need to defin...

8 years ago | 4

| accepted

Answered
How to write a .txt file in this way?
Writing that file is easy and efficient with one loop: C = {'pre','post','shift'}; [fid,msg] = fopen('test.txt','wt'); ...

8 years ago | 1

| accepted

Answered
how to select values of nx3 matrix where its index is equal to a value in other matrix
_"how to select values of nx3 matrix where its index is equal to a value in other matrix"_ As far as I can tell, you can do t...

8 years ago | 0

Answered
Matlab equality problem. Please help.
You have to learn about floating point numbers, and why you should not test them for equality like that. Always compare the abso...

8 years ago | 0

| accepted

Answered
How does logical indexing work ?
v = v1(v1 > 6) _"stores in v the elements of v1 that are greater than 6."_ Yes. Because that comparison returns a _logic...

8 years ago | 2

| accepted

Answered
changing dimension in a loop
There is a neat trick for that: simply put the indices into a cell array, which you can then redefine using indexing. S = n...

8 years ago | 1

| accepted

Answered
use of variables in cellst and num2cell
Copied from the MATLAB documentation: <https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html> ...

8 years ago | 1

Answered
I have an input array 'z' with which I want to create an array 'p' in the way given below. The length and values of 'z' is varying. How I can register 'p' for every case of 'z'. Thank you
>> z = [-0.5,-0.25,0,0.25,0.5]; In two lines using |repmat|: >> p = repmat(z,2,1); >> p = p(2:end-1) p = -0...

8 years ago | 0

| accepted

Answered
Accessing all lower elements of a structure
_"so I expected similar functionality for a structure."_ There are easy ways to access structures, but not with the kind of "...

8 years ago | 0

| accepted

Answered
How to reshape array items and put them in a single cell
Where |M| is your 360x1280 matrix: C = squeeze(num2cell(reshape(M.',10,128,360),1:2));

8 years ago | 0

Answered
How to Input a function equation in matlab
>> b = 1; >> a = 2; >> hm = 0.5; >> kt = 0.9; >> fun = @(F) F - hm*(a-b)*log(1+F/(hm*(a-b))); >> y = fzero(@(x)...

8 years ago | 0

Answered
Get error message of 'Error using max Invalid data type. First argument must be numeric or logical' when I attempt to apply max function to a column of data
Your data has class _table_. Tables are a _container_ class: they _contain_ data of other classes: <https://www.mathworks.com...

8 years ago | 2

| accepted

Answered
interesting matrix indexing question without for loops
Use <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|> to get the <https://www.mathworks.com/help/matlab/math/ar...

8 years ago | 1

| accepted

Answered
Changing input name to save data from zip files into a data cell?
"Is there any way to right a loop that will change the name of the input??" Of course, just follow the advice in the MATLAB doc...

8 years ago | 0

Answered
Using regular expression to read part of the filename
>> str = '5_20180927_161742655'; >> regexp(str,'(?<=_)\d{8}_\d{6}','match','once') ans = 20180927_161742 Note that th...

8 years ago | 0

| accepted

Answered
Create a Button in a figure which activates another function
function [x,y] = getpts_zoom(pic_analyze) x = []; % Must be specified in the main workspace. y = []; % Must be specified...

8 years ago | 0

Answered
How to generate a vector of uniformly distributed numbers around 1?
>> 2*rand(1,10) ans = 1.324304 0.866104 0.570201 1.248882 0.425728 1.720565 0.022849 1.249922 1.82846...

8 years ago | 0

| accepted

Answered
PDE toolbox: Undefined function 'mtimes' for input arguments of type 'function_handle'.
A <https://www.mathworks.com/help/matlab/function-handles.html function handle> is not a <https://www.mathworks.com/help/matlab/...

8 years ago | 0

Answered
Unexplainable huge performance degradation
_"Unexplainable huge performance degradation"_ *Explanation:* it is quite well documented that scripts are slow and so are gl...

8 years ago | 2

Answered
Increment different rates in same for-loop
*Method one: a loop:* N = 8; Z = nan(1,N); % preallocate for k = 1:N Z(k) = M1(k) * M2(ceil(k/2)) * M3(ceil(k/...

8 years ago | 1

Answered
Why are my vectors different lengths?
t = T*(1:numel(y));

8 years ago | 0

Answered
How to replace matrix NaN with string from cell array
C = {'# 2.537','1.219','0.457','0.214','# 0.120','0.245';'3.244','# 1.400','0.649','0.515','0.207','0.075'}; mat = str2doub...

8 years ago | 1

| accepted

Answered
Split data into different arrays of different sizes?
accumarray(index(:),a(:),[],@(v){v})

8 years ago | 0

Answered
Use while-end, if-end, break commands to solve the numerical problem
_"if anyone could point me in the right direction that would be appreciated"_ Your assignment points you in the right directi...

8 years ago | 0

Load more