Answered
300dpi or 300dpcm?
It's DPI, based on the documents provided by MathWorks here: <https://www.mathworks.com/help/matlab/ref/print.html#inputarg_reso...

8 years ago | 2

| accepted

Answered
How can I cancel ("NaN" value) elements of a matrix based on another matrix's "NaN" values?
Use <https://www.mathworks.com/help/matlab/ref/isnan.html |isnan|> to find where NaN values are. Then replace elements in A with...

8 years ago | 0

Answered
Strange Behavior of Matlab
Nothing's wrong with the equation, but it's an approximation error caused when you're dividing/multiplying numbers with many dec...

8 years ago | 0

| accepted

Answered
problem with adding second x-axis linked to first x-axis
To resolve the top axis label going off the figure, reset ax1 and ax2 positions based on the minimum border required (TightInset...

8 years ago | 0

Answered
How can I make figure title and annotations selectable?
See the example below. It draws a figure, and if you click above the axes area (where the title is), then it will save the title...

8 years ago | 0

| accepted

Answered
Comparing Elements of two matrices if loop
Hi Esther, this is one of many ways to do this. %Reshape A into 2-columns matrix (called Ar) to avoid having to use nested...

8 years ago | 0

| accepted

Answered
Divide matrix in to vectors using for-loop
Almost had it right. Use <https://www.mathworks.com/help/matlab/ref/cell.html |cell|> instead of y1, y2, y3, etc. Your "y1" can ...

8 years ago | 0

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #4 (and bug reports)
Suggestions: * when answerer is working on a question and someone else posts a new comment/answer, show a popup before answer...

8 years ago | 5

Answered
Masked image displaying wrong intensity
Try this instead, which will select only the pixels in |image| dictated by the |mask|: %to get the masked image without cha...

8 years ago | 1

| accepted

Answered
Translate if statement in code to math
prob = exp(-dE / kT); %define probability as prob = e^(-dE/kT), where dE and kT are some value if dE <= 0 || rand(...

8 years ago | 0

Answered
GUIDE: missing data in handles
Based on what I've tested with your code, |get(hObject,'String')| will NOT get the current string in the edit text box, but the ...

8 years ago | 0

| accepted

Answered
Extract columns in a loop
Is this what you want to do? zt3 = [1:20000]'; %assuming zt3 is a 20000x1 matrix Test = reshape(zt3, 2000, 10); %Takes...

8 years ago | 0

| accepted

Answered
How to convert a numeric string into a numeric range?
In case the user inputs out-of-order range, duplicate numbers, or negative numbers, this solution works too and is ~3x faster. B...

8 years ago | 2

Answered
Fast dot product in three dimensions
Here's a bunch of options. Not sure if A or B is a constant, or changes with loop, so the solution you want depends on what the ...

8 years ago | 0

Answered
Hi.. this program contains no errors, I do not know why the compilaton is long !!!
I'm getting that |norm| is the slowest step, follow closely by that nested for loop that Chad is pointing out. There's a |sqrt| ...

8 years ago | 0

Answered
Struct contents reference from a non-struct array object. again
Double clicking the |.fig| to open the GUI skips both the creation of handles and also the |OpeningFcn|, hence there's no handle...

8 years ago | 0

Answered
Convert image to AVI
function [ output_args ] = images2Avi(searchstring, outfilename, fps, quality, width) %IMAGES2AVI Summary of this funct...

8 years ago | 0

Answered
how to sum all adjacent elements in a matrix with 1's and 0's?
MyMatrix = [1 0 1 0; 1 0 0 1; 0 0 0 1]; %your m x n matrix, m ~= n msk = [1 1 1; 1 0 1; 1 1 1]; z = conv2(MyMatrix, ms...

8 years ago | 0

| accepted

Answered
Operation on variables whose name contain a certain string.
In case you're stuck with 1000's of |treated_data_blahblah|, here's an example showing how to work around this issue by correcti...

8 years ago | 1

Answered
xlsread with sheet selection and xlRange
Looks like your excel file has nothing but string data, hence the 1st output of |xlsread| will give you empty (no numeric data t...

8 years ago | 1

| accepted

Answered
Graph drawn over axis box- error in clipping or graphics object order
This worked for me - set the axes Layer to Top: set(gca, 'Layer', 'Top') More about axes properties here : <https://www...

8 years ago | 1

| accepted

Answered
Parallelize calculations on a big cell array without making N input copies
If each calculation is independent (as in, you don't need the entire 15000000x1 cell to make 1 calculation), then you could rewr...

8 years ago | 0

| accepted

Answered
imshow and Scatter in GUIDE
Calling |imshow| can delete the previous axes handle (which is your |handles.axes1| and thus your |hScatter| too). The follow...

8 years ago | 1

Answered
How to create multiple excel sheets in Matlab?
Looks like you're overwriting sheet 1 in the last line of your script. sheet = 1; writetable(Tab1,filename,'sheet',1,'Rang...

8 years ago | 1

| accepted

Answered
Trying to link two matrices based on 2 columns in each
Try using <https://www.mathworks.com/help/matlab/ref/intersect.html |intersect|>. %A represents the large matrix. Col 2 and...

8 years ago | 0

Answered
Error using textscan Invalid file identifier. Use fopen to generate a valid file identifier.
mfilePath = fileparts(mfilename('fullpath')); % path to script file pathToDatabase = fullfile(mfilePath, 'ASV...

8 years ago | 0

Answered
Assign all the elements in a row vector to a matrix but couldn't use the reshape function
sub_results = (1:200); result = reshape(sub_results, [8 25])'; %Use transpose operator " ' " result = 1 2 ...

8 years ago | 0

| accepted

Answered
How to output a for loop as a table with each iteration and result displayed
p = 10; Table = cell(9, 2); %cells are more versatile than matrix as tables for i = 1:9 p = p * 2; Table(i...

8 years ago | 2

Answered
Strings and access to matrix elements
Ah, we were all inefficient coders at one point. Here's how to implement what the rest are suggesting: x = -1:0.01:1; D...

8 years ago | 0

| accepted

Answered
How to clear everything but a structure
Try wrapping your script for extracting |Data| from a |File| into a function called |getFileData|. function Data = getFileD...

8 years ago | 0

| accepted

Load more