Answered
Skipping 0 value in matrix computation wich lead to NaN.
Before you take the log, get rid of the 0's: p = p(p ~= 0);

9 years ago | 0

| accepted

Answered
What is the meaning of A{1}
A{1} is the content of the first cell in a cell array.

9 years ago | 1

Answered
Find range between two array's indexes
If you use that highest value that is still smaller than the corresponding B, you can write: C = [A(arrayfun(@(i) find(A < ...

9 years ago | 1

Answered
How do I delete a row in a matrix where the first value isn't in a corresponding matrix?
Create a logical index that has a 1 at each position where fileid has no match in id: idx = ~ismember(fileid, id); Dele...

9 years ago | 0

| accepted

Answered
I have to plot multiple graphs on the same plot reading .sgl files ; the code i have is as follows; I am not sure how to make it read every file in turn; thanks
If filelist is a cell array of your filenames, use for i = 1:numel(filelist9 sgl=read_hsgl_riff(filelist{i}); % m...

9 years ago | 0

Answered
How do I label a plot as an object?
You can add a pause after each plot plot(time, temp) xlabel({'Time','(minutes)'}); ylabel({'Temperature','(°C)'}); ...

9 years ago | 0

Answered
Transform content of cell array to strings
cellfun is your friend here. The first argument of cellfun is an anonymous function of one argument, named c. cellfun then passe...

9 years ago | 0

| accepted

Answered
filter parameters using if else
[a, ~, c] = unique(B(:,1)); Bnew = [a arrayfun(@(x) max(B(c==x,2)), 1:numel(a))']

9 years ago | 1

| accepted

Answered
Calculate value based on previous row plus adjacent row
A = [0:5]; B = [0 1 3 6 10 15]; ind = 3:6; C(ind) = A(ind) + B(ind-1) M = [A' B' C']

9 years ago | 0

Answered
Changing Values in Function
It may help to define the variables outside to the local function % create the figure lowThreshold = 0; % assign dummy v...

9 years ago | 0

Answered
How do I edit the legend when I have *many* entries (but only 2 types of data)
if pltvar1srt(i) == 1.71 && 4 set(h,'FaceColor',cm(1,:)); hlegend(1) = h; else set(h,'FaceCo...

9 years ago | 1

| accepted

Answered
Calculate the difference between two points extracted from a loop?
x(101:103) = 1; x(1090:1091) = 1; x(1200:1201) = 1; x(2201:2203) = 1; x(3200) = 1; istart = find([0 d...

9 years ago | 0

Answered
TIFF (Tagged Image File Format) Compression
This may be helpful: <https://havecamerawilltravel.com/photographer/tiff-image-compression> The criterion for compression is ...

9 years ago | 0

| accepted

Answered
How can I use Otsuthresh correctly to convert an image to binary?
I your aim is to separate the bacteria from the background, I think you cannot do this with a simple thresholding, because the i...

9 years ago | 0

| accepted

Answered
Correct way of plotting images
I usually use imshow(J, []) to view the full range of data. In the end, data are always quantized to be shown as 24bit R...

9 years ago | 0

Answered
How to save a figure in a different directory and with a dynamic name using export_fig?
Some hints, since it appears to be homework: help fileparts % separate path, name and extension help fullfile % to gen...

9 years ago | 0

Answered
Writing math formula into the matlab
It depends on the context, but your code is probably wrong. You have some variable H that seems to vary according to i, l and j....

9 years ago | 0

| accepted

Answered
Trying to reduce the size of an image
You can write the image to jpg and adjust the 'Quality' between 0 and 100 to reduce the size (lossy compression): imwrite(I...

9 years ago | 0

Answered
how can I calculate number of pixel in each angle of a circle??
I = imread('../../Downloads/testimage.jpg'); % use ginput to determine the center: click where the center should be, % t...

9 years ago | 0

Answered
What is the best way to find an accurate threshold value for im2bw?
Steve's blog may help: <http://blogs.mathworks.com/steve/>

9 years ago | 0

Answered
Calculate Area under Surface
x = 1:60; y = exp(-0.1*x); % sample data plot(x,y) trapz(y) % area under the curve Note that if the curve is below...

9 years ago | 0

Answered
how to save all iteration matrices and put it into big one
You don't have to create splitQ, you can work on Q directly: ind = 1:19:size(Q,1); % create the starting indices of the rows...

9 years ago | 0

| accepted

Answered
Moving specific files to specific folders
direc = dir; filenames = {}; [filenames{1:length(direc),1}] = deal(direc.name); first3 = cellfun(@(x) x(1:3), filename...

9 years ago | 0

Answered
I would like to draw a plot like below just exact like image below, How can I do that ?
x=[1:6]; y=[0.19 0.525 1.175 2.795 7.008 20.210]; ax_invisible=axes('color','none','Ytick',[]); ax2=axes; ...

9 years ago | 2

| accepted

Answered
How can i plot a continuous graph with NaN in matlab?
x = sum(mat, 2); A = mat(~isnan(x), :); subplot(2,1,1), plot(A(:,1),A(:,3)); subplot(2,1,2), plot(A(:,1),A(:,4));

9 years ago | 1

Answered
How can I open a fig from a subfolder?
openfig('./yoursubfolder/your.fig')

9 years ago | 0

| accepted

Answered
How to find floor value of a cell??? please help....
floor(cell2mat(C))

9 years ago | 0

Answered
How to "highlight" an individual bin in a histogram?
You can draw a patch on top of the bar you like to highlight: Create the histogram H = histogram(a); Highlight the it...

9 years ago | 2

| accepted

Answered
how to load matrices from mat file
load yourmatfile.mat for i = 1:20 for j = 1:25 eval(['A1(:,:,' int2str(i) ',' int2str(j) ') = A1B' int2str(i) 'C'...

9 years ago | 1

| accepted

Answered
Can you move figures in subplot in there given subplot location?
h = subplot(5, 2, 10); % your plot command here % adjust position; the offset has to be determined by visually by trial a...

9 years ago | 1

| accepted

Load more