Answered
how to reach amount of entropy of image in between the range [0,1] ?
You can scale the output by the maximum entropy for this image H = entropy(I); N = numel(I); maxH = entropy([1:N]/N); ...

9 years ago | 1

| accepted

Answered
dbhole.mat contains 334 files. each files consists of [2xn] data. i sort these files with name starting with 'd' and fixed 'h2'. if h2 is not fixed, then what will be the code for doing this?
I would organise the data into a 2D cell data{}{} and work with this structure. load dbhole.mat W = whos('d*h*'); ...

9 years ago | 0

Answered
Edge detection is working too well for me?
If the walls are always vertical, you can sum the output of the edge detector across all rows and determine the x positions from...

9 years ago | 1

| accepted

Answered
hello sir i want real values but when i write my function in matlab s(ii)==real (s(ii)); it give me complex value how to solve it
real is the real part of a complex number. Unless you do not have re-defined Matlab's real, this should work. To check if you...

9 years ago | 0

| accepted

Answered
Issues with Matrix Multiplication
i_D=I0.*(exp((q*v_D)./(k*T(ii)))-1);

9 years ago | 0

| accepted

Answered
search for a string in a set of cell arrays
Strings_1 = {'abc';'def'} Strings_2 = {'ghi';'jkl'} str = 'def'; S{1} = Strings_1; S{2} = Strings_2; ...

9 years ago | 0

Answered
Could someone please help me speed up my code?
I found this to run much faster (about 23s on my machine): preallocate RMS_new, move the squaring and the division by N (to comp...

9 years ago | 1

Answered
Unbalanced or unexpected parenthesis or bracket.
If you have a pre-2009b version, the tilde could cause the error. Replace each tilde ~ with something like dummy or variable_not...

9 years ago | 0

Answered
How to load only a subset of .dat files into MATLAB?
for k=1:6 load(files(k).name); end

9 years ago | 0

Answered
Select subset of data going backwards
i1 = find(a(:,6) > 0, 1, 'first') i2 = find(a(1:i1, 3) == 1, 5, 'last') res = flipud(a(i2, 4))

9 years ago | 0

Answered
Is there a way to extract specific fields from a structure?
help getfield

9 years ago | 2

Answered
How to change a certain value color in pcolor
cmap = colormap; N = 10; x = linspace(1, size(cmap, 1), N); cmap = cmap(x, :); pink = [255 204 221]/255; cmap(5...

9 years ago | 0

| accepted

Answered
how can convert a mat file to netcdf?
Use ncwrite

9 years ago | 0

Answered
cumsum within a group
data=[1 10 10; 1 10 20; 1 10 30; 1 10 40; 2 10 10; 2 15 25; 2 20 45; 3 5 5; 4 10 10]; % first column of tcumsum ye...

9 years ago | 0

Answered
finding a string in a cell array
out = find(cell2mat(regexp(ids1, 'EPS[1-5]MN')))

9 years ago | 0

Answered
"Exist" return 0 for a file it displays when using "ls"
On my system (MacOS 10.11) Matlab returns 2, as expected. I would try to get rid of the '.' in the file names and see if it work...

9 years ago | 0

Answered
Dear all: I have a 5*2 matrix. i want to find out the row and column of a special value.let A=[1 2;4 5; 1 8;2 6;9 7] I want to find the row and column of 9 and 7.how can i do this?
If your matrix has the same number of columns as your vector, as in your example, you just have to find the row: r = find(i...

9 years ago | 1

| accepted

Answered
How to convert 'comma' to 'dot'?
You can use my function fstrrep to replace each . with a , and then use dlmread to read the data: fstrrep('test22.txt', ','...

9 years ago | 0

| accepted

Answered
Legend position change after printing
Use set(gcf,'PaperPositionMode','auto'); before printing. It works for me (R1015b).

9 years ago | 0

Answered
datestring shows incorrect answers
Igor Pro uses the seconds since 1904-01-01. So you can convert it using dv = datevec(3534468465.15625/(3600*24) + datenum(19...

9 years ago | 0

| accepted

Answered
Delete files with specific names
You can get the filenames using d = dir; filenames = {d.name}; Loop through the filenames for i = 1:numel(file...

9 years ago | 1

| accepted

Answered
please explain this code mean? especially the 'm' and the 's'?
Have you considered looking at the reference? R. C. Gonzalez, R. E. Woods, & S. L. Eddins Digital Image Processing Using MATLA...

10 years ago | 0

Answered
I have a two 2D Arrays with 140 zeros, for the 1st I want 70 numbers to have a value between 0 to 1, for the 2nd I want the remaining 70 to have a value <1 and >0
N = 140; ind = randperm(N); D1 = zeros(1,N); D2 = zeros(1,N); D1(ind(1:N/2)) = rand(1,N/2); D2(ind(N/2+1:end)) ...

10 years ago | 1

| accepted

Answered
In a table with duplicate ids, how do I merge rows with values with rows with NaNs?
X = [3101 6 NaN 6 NaN 3101 NaN NaN NaN 1 3101 NaN 4 NaN NaN 8701 5 5 5 Na...

10 years ago | 0

Answered
Save text files without an empty line in the end?
Use fprintf with newline \n for all but the last entry in x, which is written separately without \n: x = [1;2;3]; fid = ...

10 years ago | 0

| accepted

Answered
How to place the last alphabetic character from TS1
TS1='%@3Gb6'; Lastletter = TS1(max(regexp(TS1, '[a-zA-Z]')))

10 years ago | 0

Answered
Saving a figure with several subplots on to a file
print(figHandle,'-dpng','-r0',name)

10 years ago | 1

| accepted

Answered
can any one help me for the code
Si = rand(1,100)>0.5; % fake some sample data f = rand(1, 100); fmin = 0.3; fmax = 0.7; Siplus = Si; % the otherwise ...

10 years ago | 0

Answered
To accept two numbers from the user and display perfect numbers between these two numbers. Can anyone help to convert this codes to somethings simpler to understand?? It's too complicated for me as i'm still new to matlab...
The if clause may be too tricky for a beginner: (sum(test(mod(i,test) == 0)) == i) Let's walk through it from the innerm...

10 years ago | 2

Answered
imcrop won't work
I = rand(1000, 2000); rect = [1029,535,1,1]; Ic = imcrop(I, rect) The thing to remember is that the rect is given by [xm...

10 years ago | 0

Load more