Answered
How to switch between Graphs in a GUI
One efficient solution is to plot _all_ of the data in one/several axes, then just set the axes/line/patch/... |Visible| propert...

8 years ago | 0

| accepted

Answered
Why will round() not work on this number for 4 decimal places?
_"Why will round() not work on this number for 4 decimal places?"_ It does work. It rounds to the nearest floating point numb...

8 years ago | 2

| accepted

Answered
Maximum Edit Distance code
The _maximum_ <https://en.wikipedia.org/wiki/Edit_distance edit distance> between any two strings (even two identical ones) is _...

8 years ago | 0

Answered
Prevent Overwrite Image in loop
N = 16; C = cell(1,N); for k = 1:N F = sprintf('image%d.bmp',k); C{k} = imread(F); end All of the im...

8 years ago | 0

| accepted

Answered
How can I find indices of each unique elements in a matrix, in one shot. (efficiently)??
>> [~,idx] = sort(mat(:)); >> reshape(idx,10,10) ans = 3 6 7 59 56 53 51 8 4 1 ...

8 years ago | 1

| accepted

Answered
Delete max value of a cell array?
_"So my array is in a bad format or what can I do?"_ Yes it is, if you want to do numeric operations. Storing numeric data in...

8 years ago | 0

| accepted

Answered
how to store many result in csv file in a row ?
You need to change the filename for each loop iteration, e.g.: fnm = sprintf('test_%04d.csv',i); csvwrite(fnm,u) Othe...

8 years ago | 0

| accepted

Answered
How to use inerpolation option with end values? If I use interp1 command it's giving NaN as the output if input is out of the range. I want to use end values if input is out of the range?
>> X = [1,2,3]; >> Y = [12,5000,12000]; >> interp1(X,Y,4,'nearest','extrap') ans = 12000 >> interp1(X,Y,4,'linear...

8 years ago | 0

| accepted

Answered
how to save the specific variable for each image when I have done batch image processing?
_"When I process all images, it only shows the last image I processed in the workspace."_ No problem. _"Can I save the res...

8 years ago | 0

| accepted

Answered
problems with intersect and cellfun functions
>> [~,~,rawS] = xlsread('state.xlsx'); >> [~,~,rawP] = xlsread('pinellas.xlsx'); >> [idxP,idxS] = ismember(rawP(:,1),raw...

8 years ago | 1

| accepted

Answered
How can I get exactly the execution time for my my code in Malab?
<https://www.mathworks.com/help/matlab/ref/timeit.html>

8 years ago | 0

Answered
How to run executable file (.exe) with input information using MATLAB
Add the arguments to the character vector: <https://www.mathworks.com/matlabcentral/answers/4538-how-to-call-an-exe-with-comm...

8 years ago | 0

Answered
Copying a struct without knowing its full variable name
The simplest solution by far is to <https://www.mathworks.com/help/matlab/ref/load.html |load|> the |.mat| files into an output ...

8 years ago | 0

Answered
Upper script Variable in the text
Put curly braces around the part you want to be superscript: ^{...} The TeX/LaTeX languages use curly braces to group th...

8 years ago | 0

| accepted

Answered
About maximum value in matrix
This can be done using <https://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: A = [2,4,-1,0,-1;1,3,12,-3,2;-12...

8 years ago | 0

| accepted

Answered
Change variable name in loop to store matrices
It is much simpler to just use indexing: S = dir('myFolder\*.txt'); N = numel(S); C = cell(1,N); for kk = 1:N ...

8 years ago | 0

| accepted

Answered
How to read a text file having strings and numeric data?
out = []; [fid,msg] = fopen('test0.txt','rt'); assert(fid>=3,msg) while ~feof(fid) str = fgetl(fid) vec...

8 years ago | 0

| accepted

Answered
Folsve issues in function definition
Get rid of these two useless lines of code: clear all clc They serve no relevant _functional_ purpose, and just cause...

8 years ago | 0

| accepted

Answered
Regular Expression pattern for matching a variable name after an operator (mathematical or logical) ?
>> regexprep('variableA*variableA','(?<=\W)\w+','newName') ans = variableA*newName >> regexprep('variableB+variableB','(...

8 years ago | 2

| accepted

Answered
How to save value of find function?
Your loop is superfluous, get rid of it. Simpler with logical indexing: >> x = [1,4,7,3,10,6,0,90,1.1,80]; >> de = x(x>0...

8 years ago | 0

| accepted

Answered
issue regarding reading .txt file with comments
More robust: opt = {'CommentStyle','#', 'CollectOutput',true}; [fid,msg] = fopen('yourfile.txt','rt'); assert(fid>=3,...

8 years ago | 0

Answered
How could I save a large image to a pdf without compression?
Use <https://www.mathworks.com/help/matlab/ref/imwrite.html |imwrite|>. All of the commands that you tried save the _displaye...

8 years ago | 0

| accepted

Answered
Pull together files of the same name from different folders
I recommend that you use <https://www.mathworks.com/help/matlab/ref/fullfile.html |fullfile|> rather than concatenating strings,...

8 years ago | 0

Answered
How to set the maximum value of a column in a matrix to 1 and other values to 0?
>> +bsxfun(@eq,M,max(M,[],1)) ans = 0 1 0 0 0 0 1 0 1 0 0 1

8 years ago | 1

Answered
Why do I get a warning message if I generate a legend?
The <https://www.mathworks.com/help/matlab/ref/legend.html |legend|> documentation specifically recommends to avoid the second s...

8 years ago | 0

| accepted

Answered
Initialize a field in all elements of a struct array
Simpler: [a.field2] = deal(1); Or if you have multiple items to use: C = {1,2,3}; [a.field2] = C{:};

8 years ago | 1

| accepted

Answered
for loop store values?
I would recommend that you use <https://www.mathworks.com/help/matlab/ref/readtable.html |readtable|> or <https://www.mathworks....

8 years ago | 0

| accepted

Answered
Matlab Bug? cell array of containers.Map
_"In my opinion, both are equal"_ They aren't. _"Is this a Matlab Bug?"_ No. _"Or can anyone explain this behavior, ...

8 years ago | 0

| accepted

Answered
How to transform a matrix to be similar to another matrix?
A = [2015,2015,2015,2016,2016,2016,2016,2017,2017,2017;... 32, 36, 42, 14, 25, 32, 36, 3, 12, 18;... ...

8 years ago | 0

| accepted

Answered
How to extract elements from datetime variable
To get the weekday from a datetime variable use <https://www.mathworks.com/help/matlab/ref/weekday.html |weekday|>. Unfortunatel...

8 years ago | 0

Load more