Answered
How do I get a bar chart in the newest version but with the colors from an older version?
"I have not been able to locate a definitive answer to what the default colors are for a bar chart." The bar documentation stat...

7 years ago | 0

| accepted

Answered
Undesired behaviour of bsxfun and colon-operator
A robust workaround using ndgrid and arrayfun and exactly the same function: >> [X,Y] = ndgrid(1:3,6:9); >> arrayfun(@(x,y)x+s...

7 years ago | 0

| accepted

Answered
How can I create all possible random combinations of word pairs without having the same values (for example, house - house)?
Pick random rows from X to get the random pairs: >> Tile = {'house', 'core', 'word', 'ask', 'question', 'horse', 'phone', 'eyes...

7 years ago | 0

| accepted

Answered
to print following pattern
Three lines, no loop, and only basic numeric operations used: >> X = 1:9; >> Y = floor((137174210/1111111111)*10.^X); >> fpri...

7 years ago | 3

Answered
combining different csv files from a folder into one matrix
"Is theremaybe a way to list the filenames in the same order, then add them afterwards as the top row to the table?" You could ...

7 years ago | 0

| accepted

Answered
Inserting more rows between already existing rows of a structure
"but I am not sure how to tansfere that onto a structure. " In exactly the same way. All MATLAB arrays use the same indexing co...

7 years ago | 0

| accepted

Answered
How to use eval and disable the edit box or drop down?
Do NOT use eval for trivial code like this! Much better is to read the documentation on dynamic fieldnames: https://www.mathwo...

7 years ago | 1

| accepted

Answered
How do I extract images from a docx (word) file?
All OpenOffice XML formats (e.g. .docx, .xlsx, etc.) constitute XML files and supporting files zipped together into one file. Yo...

7 years ago | 0

Answered
Generate combinations of Cells that contain text
Simple and efficient with ndgrid and strcat: >> [Cx,Bx,Ax] = ndgrid(1:numel(C),1:numel(B),1:numel(A)); >> D = strcat(A(Ax(:)),...

7 years ago | 2

Answered
Find Borders and their Indices
Simple and efficient using diff and find: >> D = diff([false,A==0,false]); >> B = find(D>0) % begin of run of zeros B = 1...

7 years ago | 1

| accepted

Answered
subtracting a number from string
The most efficient solution by far (and simple too!): >> str = 'subject1_EO'; >> val = sscanf(str,'subject%f') val = 1

7 years ago | 0

Answered
Convert cell to duration array
"Is there an elegant equivalent to "cell2mat" when cell content is "duration"?" Yes, this is really easy with a comma-separated...

7 years ago | 2

| accepted

Answered
i have a problem with use of natsortfiles function and divide my images
It is not clear what you expect this line structtt = cat(1,cellFileNames{:}); to do, but in actual fact it will vertically con...

7 years ago | 1

| accepted

Answered
how can i express the following question in matlab about save command?
Use uiputfile for a more professional user interface, e.g.: [F,P,X] = uiputfile({'*.jpg';'*.png'}); imwrite(A,fullfile(P,F))

7 years ago | 0

Answered
how to loop through subfolders and apply a particular function
A simple function which correctly handles special characters in the pattern and actually calls the nested function recursively: ...

7 years ago | 0

Answered
replacing uiget with pathname and filename
You use dir without any specific name+wildcards, so it will return all contents of that folder (i.e. files and folders). You the...

7 years ago | 1

| accepted

Answered
finding the right values for a vector
Use mrdivide: >> V = (1:15).'; >> a = pi; >> M = a/V M = 0.0025335 0.0050671 0.0076006 0.0101342 0.0126677 0.0...

7 years ago | 1

Answered
get the value of element from matrix
Simply use ismember and basic MATLAB indexing: >> [X,Y] = ismember(B,A(:,1:2),'rows'); >> Z = A(Y(X),:) Z = 9 9 ...

7 years ago | 0

| accepted

Answered
Finding corresponding values in double arrays in structure fields
Note that these methods assume that there is exactly one match per row. If this is not the case, then there is no way to disting...

7 years ago | 2

| accepted

Answered
filling a matrix with a loop
"Does anyone know how to do this?" This is simple and efficient with toeplitz: >> C = [1,zeros(1,399)]; >> R = [1,1,0,1,zeros...

7 years ago | 3

| accepted

Answered
anyway to translate this command using 'cellfun'
Note that it is simpler to use strfind: >> C = strfind(test,'_'); >> C{:} ans = 2 ans = 2

7 years ago | 0

| accepted

Answered
Create a matrix with random integers between 1 and 9
>> reshape(randperm(9),3,3) ans = 6 8 2 3 5 4 7 1 9

7 years ago | 0

| accepted

Answered
Meaning imaginary result of asin(x) function of MATLAB
"'My question is how can we interpret this imaginary number? Does it have any meaning? Yes, it has a meaning. Why does MATLAB ...

7 years ago | 2

Answered
What `gcbf` stands for?
gcbf get callback figure gcbo get callback object These are not necessarily the current ones.

7 years ago | 1

| accepted

Answered
Sorting columns of cell Array
Either download my FEX submission natsort: https://www.mathworks.com/matlabcentral/fileexchange/34464-customizable-natural-orde...

7 years ago | 1

| accepted

Answered
the problem of using 'case'
Your first (inadvisable, numerically fragile, should-be-avoided) concept works for me: for omega = 0.1:0.1:2; switch omega ...

7 years ago | 1

| accepted

Answered
Search a matrix combined with logical indexing
>> A = [3,10,2,5;2,14,5,3] A = 3 10 2 5 2 14 5 3 >> N = 10; >> B = A.*(cumsum(A>N,2)>0) B = 0...

7 years ago | 0

| accepted

Answered
Storing multiple value in array without overriding.
"How to avoid that?" Simply by changing the Excel worksheet name on each iteration of the outer loop, e.g.: ... for z=1:nfile...

7 years ago | 0

| accepted

Answered
How to create a for loop through a directory for only certain folders in the directory
An efficient MATLAB solution: P = 'absolute/relative path to the parent directory Sample'; S = dir(fullfile(P,'sub*')); F = {...

7 years ago | 0

Answered
How can I make an array of structs , each struct have a unique index?
"How can I make an array of structs , each struct have a unique index?" Easily: https://www.mathworks.com/help/matlab/matlab_pr...

7 years ago | 0

| accepted

Load more