Answered
Plotting anonymous functions with fsurf - involving cell arrays.
The name MATLAB comes from MATrix LABoratory, and using MATLAB is much much simpler when you put all of your data into matrices ...

9 years ago | 0

Answered
How to do double strings match in single statement
C = {... 'Re/Attempt','12';... 'Normal','24';... 'Normal','13';... 'Re/Attempt','26';... 'Re/Attempt','...

9 years ago | 2

Answered
Comparing matrices of different length
For large matrices you could (possibly) speed up your code by only using one loop, and <https://www.mathworks.com/help/matlab/ma...

9 years ago | 0

Answered
Comparing matrices of different length
If the matrices are not large then you can easily use <https://www.mathworks.com/help/matlab/ref/permute.html |permute|> and <ht...

9 years ago | 0

Answered
mat file loading problem with matlab2015b
You have created a variable named |load|, and you are attempting to index into it. Next time this error occurs, run these comman...

9 years ago | 0

| accepted

Answered
How to generate specific number of specific integers within a range?
This is easy with <https://www.mathworks.com/help/matlab/ref/randperm.html |randperm|>: >> vec = repmat(1:4,1,2); >> out...

9 years ago | 0

| accepted

Answered
how to read csv file with space character?
If the delimiter are simple space characters, then use <https://www.mathworks.com/help/matlab/ref/dlmread.html |dlmread|>: ...

9 years ago | 0

| accepted

Answered
How to reduce the number of unique values in a matrix?
Although your data is arranged in a matrix, the matrix is a red-herring because actually you want a simple 1D clustering of the ...

9 years ago | 0

| accepted

Answered
convert column to matrix
Use <https://www.mathworks.com/help/matlab/ref/griddata.html |griddata|>, probably something like this: [yq,xq] = ndgrid(0:...

9 years ago | 0

| accepted

Answered
I have a problem to making all possible combinations ???
Download Jos's excellent FEX submssion <https://www.mathworks.com/matlabcentral/fileexchange/7147-permn-v--n--k- |permn|>, and u...

9 years ago | 0

Answered
How do I count number of loops done in multiple 'for' sentences?
k = 0; for x = 1:50:500 for y = 1:50:300 k = k+1; ... your code end end

9 years ago | 0

| accepted

Answered
how to input a string into a function?
It is not totally clear what you are trying to achieve with that function, as you are both printing the output to the command wi...

9 years ago | 1

Answered
imshow index issues with display
_"is there a way to convert from a 453x1x501 variable to a 453x501 variable"_ squeeze(...)

9 years ago | 0

| accepted

Answered
How to multiply two user input expressions?
You could use <https://www.mathworks.com/help/matlab/ref/str2func.html |str2func|>: str1 = input('Function f1(x): ','s') ;...

9 years ago | 0

| accepted

Answered
How can I create a cell array whose cells are strings based on a sequence of integers 1:N (for any N)?
This works for any MATLAB versions: >> arrayfun(@num2str,1:3,'Uni',0) ans = '1' '2' '3'

9 years ago | 0

| accepted

Answered
Import mixed-format text file of unknown number of columns
You can identify the column contents (numeric vs. string) with a few |fgetl| calls, before importing the data with one |textscan...

9 years ago | 2

Answered
Minimisation of function that contains vectors as constants
When you calculate the _equivalence_ like this (...)==KK then the output can have only two possible values: true or fals...

9 years ago | 0

| accepted

Answered
Find values in array a based on unique values in array b as well as based on the range of values in b
A = [ 1, 2, 3, 4, 5, 6, 7,8, 9,10,11,12,13,14,15,16, 17]; B = [10,14, 3,21,21,21,21,3,14,14,14, 2,75,13,13,13,100]; X = ...

9 years ago | 0

| accepted

Answered
Why is this loop not ending?
It would be simpler to use a |for| loop, then |break| is not required: function num = SmallestNumber(n,a,b) num = Inf; ...

9 years ago | 0

Answered
is it possible to sort structure arrays along 1 field.
<http://blogs.mathworks.com/pick/2010/09/17/sorting-structure-arrays-based-on-fields/> <https://www.mathworks.com/matlabcentr...

9 years ago | 2

| accepted

Answered
Load file with changeable variable
Don't waste your life writing buggy code. Much simpler and much more reliable would be to use a cell array: C = {... ...

9 years ago | 0

| accepted

Answered
Comparing strings in two different tables with eachother
if strcmp('07/04/17 02:55:00',data_table{i,1}) ^ ^

9 years ago | 1

| accepted

Answered
I can not create a matrix
This is simple with <https://www.mathworks.com/help/matlab/ref/toeplitz.html |toeplitz|>: >> nC = 3; >> nR = 6; >> vC...

9 years ago | 0

| accepted

Answered
convert the field of a struct in a matrix
Because some of the |WA| fields are empty, you will have to use a cell array: out = reshape({MaxST.WA},[71,71]) If all o...

9 years ago | 1

| accepted

Answered
Related to mean function
Why not read the MATLAB help? You can do this easily from MATLAB itself: doc mean Or by using your favorite internet sea...

9 years ago | 0

| accepted

Answered
How can I save a matrix that is set within a loop?
I would use <https://www.mathworks.com/help/matlab/ref/accumarray.html |accumarray|>, which makes this quick and efficient to im...

9 years ago | 2

| accepted

Answered
location of element in matrix
*Do NOT use |ismember|* Those are floating point values. It would be an extremely bad idea to use |ismember| on floating poin...

9 years ago | 3

Answered
Replacing each array element with a series of values
>> T = [1,4,7]; >> cell2mat(arrayfun(@(n)n+(0:2),T,'uni',0)) ans = 1 2 3 4 5 6 7 8 9

9 years ago | 1

| accepted

Answered
Indexing for a character vector and referring to them in a while loop?
k = 0; S = struct(); str = 'X'; while ~isempty(str) str = input('What would you like to do: ', 's'); sw...

9 years ago | 0

| accepted

Load more