Answered
Read .csv files in the right order
The simplest solution is to download my FEX submission natsortfiles and use it like this: D = 'C:\directory'; S = dir(fullfile...

8 years ago | 1

| accepted

Answered
How do I get the last element of a cell array from a function call?
Write the function to accept a special case, e.g. an empty array indicates |end|: if isempty(location) step_Boundary...

8 years ago | 0

| accepted

Answered
How can I import specific rows from a very large CSV file?
It is not required to split up the file. You basically have two choices to get the rows that you want: * Use <https://www.mat...

8 years ago | 0

| accepted

Answered
Saving and manipulating iterating matrices.
You either need to use a loop (explicitly or implicitly using |cellfun|) or covert the cell array to a numerc array (which is ea...

8 years ago | 0

| accepted

Answered
question of 'uigetfile' command order
The <https://www.mathworks.com/help/matlab/ref/uigetfile.html |uigetfile|> help states that _"File names in the cell array are s...

8 years ago | 0

| accepted

Answered
How can I sum every nth row?
A = [1 2 3 4 5 6 7; 1 3 5 7 9 11 13; 2 4 6 8 10 12 14]' N = 3; S = size(A); V = N*ones(1,ceil(S(1)/N)); V(end) = 1...

8 years ago | 1

Answered
Formatting text description for FEX submission
_"... empty lines between paragraphs don't really work either. It doesn't do it every time..."_ I noticed this as well. I did...

8 years ago | 0

Answered
With a = 1:4 and b = [], why does a(1) = [] remove an element while a(1) = b returns an error?
Basically this is a "special" syntax: X(...) = [] <https://www.mathworks.com/help/matlab/matlab_prog/matlab-operators-an...

8 years ago | 3

| accepted

Answered
Converting RGB surf plot to stl file for 3D printing
You can download some STL file conversion tools from FEX: <https://www.mathworks.com/matlabcentral/fileexchange?term=STL> ...

8 years ago | 1

| accepted

Answered
How to properly transpose a matrix
Regardless of the input size, this will give a column vector: Array = Array(:)

8 years ago | 1

| accepted

Answered
convert mxn matrix to 1x1 cell
c = {a}; save('myfilename.mat','c')

8 years ago | 0

Answered
How do I minimise a function that has a vector output?
_"I would like to know if there is a function that changes the input angles to minimise all six elements in the output error vec...

8 years ago | 1

Answered
Mean of nested cell arrays
>> M = cell2mat(permute(cat(3,cv_perf{:}),[2,1,3])); >> Z = mean(M,3) Z = 0.058748 0.078402 0.095877 0.0...

8 years ago | 0

| accepted

Answered
How to convert datetime vector to military time
_"How can I change the format of the datetime array to military time so that the times may appear in chronological order?"_ Y...

8 years ago | 0

| accepted

Answered
string from a textbox
If you are using symbolic toolbox then you could use the appropriate function: <https://www.mathworks.com/help/symbolic/coeff...

8 years ago | 0

Answered
Sorting matrices in matlab
>> B = A([1:2:end,2:2:end],:) B = 2 8 7 1 4 4 8 2 8 8 8 7 6 7 8 ...

8 years ago | 0

| accepted

Answered
I can't recall matrix
_"anyone can help why this is happened?"_ Because that is _not_ how to use <https://www.mathworks.com/help/matlab/math/matrix...

8 years ago | 1

| accepted

Answered
sprintf problem working in linux but not working windows and i checked the old posts and they donot work with me?
You need to escape all of the backslashes (this is clearly shown in the *Special Character* table of the <https://www.mathworks....

8 years ago | 0

| accepted

Answered
Is there a way to sort text file in matlab?
>> str = fileread('kvadrat2.txt'); >> tkn = regexp(str,'^GRID\*\s+\d+\s+(\d+,\d+)\s+(\d+,\d+)\s+\d+\s+\*\s+\d+\s+(\d+,\d+)'...

8 years ago | 1

| accepted

Answered
How to transfer variables between GUIs??
_"I have used the matlab function 'getappdata' to store the variables and 'setappdata' to load the variable in another GUI"_ ...

8 years ago | 0

| accepted

Answered
Adding multiple interp1 in a loop
This is easy one you avoid the counter-productive <https://en.wikipedia.org/wiki/Anti-pattern anti-pattern> of creating numbered...

8 years ago | 0

| accepted

Answered
Unexpected MATLAB expression.
MATLAB does not have implicit multiplication between adjacent values or variables. You need to write the multiplication explicit...

8 years ago | 1

Answered
how can i create a matrix in a loop and have some elements changing with every iteration
n = 9; c = cell(1,n); for k=1:n c{k} = 1*k+ones(10); c{k}(5,:) = 0 % change the fifth row's values. end...

8 years ago | 0

| accepted

Answered
how do I remove value in a vector (duplicate) which already have reach a max value?
>> A = [0.1 0.2 0.2 NaN 0.5 1.0 0.4 0.6 0.6 1.0 1.2]; >> B = A(A~=0 & ~isnan(A)); % remove NaN and zero. >> B = B(diff(B...

8 years ago | 0

| accepted

Answered
fread returns empty result for .src file
fileid=fopen('mysrcfile.src', 'w'); ^ This opens a file in WRITE mode! ...

8 years ago | 0

| accepted

Answered
Multiplying vector members without repeating
>> A = 1:4; >> prod(nchoosek(A,2),2) ans = 2 3 4 6 8 12

8 years ago | 0

| accepted

Answered
custom colormap with missing colors
You could: 1. specify the limits, and provide the axes handle when calling |colormap|: imshow(im,[1,3]); colormap(gca...

8 years ago | 1

| accepted

Answered
What would be the way to use one 3D array as index for other 3D array?
The simplest solution is to use a temporary variable: >> tmp = a(2,:,:); >> x = tmp(o) Another option would be to con...

8 years ago | 0

| accepted

Answered
How to plot billions of points efficiently?
Here is one way to subsample the data to produce almost identical plots: % Fake data: X = 10.^randn(2e4,1); Y = 10.^r...

8 years ago | 0

| accepted

Answered
dividing a bigger array into sub-arrays and saving them as array-element
You could use a cell array: cl = cell(30,1); %initialize the array cl{1} = cl1; cl{2} = cl2; etc. Note t...

8 years ago | 0

| accepted

Load more