Respondida
code for calculation of area of histogram
Assuming you have your image stored as a greyscale image: intensities=sort(IM(:)); PD11=intensities(ceil(0.11*numel(intensitie...

más de 7 años hace | 0

| aceptada

Respondida
Organising cells from a cell array
Matlab stores 2D arrays column by column, so if you want to keep it row by row, you need to transpose your array. The code below...

más de 7 años hace | 1

| aceptada

Respondida
Sums from different groupings
You can pad a grouping with NaN values and still use a similar idea as your other question: x=1:17; N=3; if mod(numel(x),N)~=...

más de 7 años hace | 1

| aceptada

Respondida
Index exceeds the number of array elements
This would also work: x=(1:30)'; Result=sum(reshape(x,3,[]))'; The transposes are not needed, but are only there to keep inpu...

más de 7 años hace | 1

Respondida
Array Indexing Question MATLAB
It is not the most beautiful code, but it works: clc figure(1),clf(1) %get the default image image;ax=get(gcf,'Children'...

más de 7 años hace | 0

Respondida
How can I let the surf function in matlab to wait for user prompt before showing up the figure.
This code should solve it. Your second call to surf would replace the first, so I put in a call to subplot. You could also plot ...

más de 7 años hace | 1

| aceptada

Respondida
Manipulating and assigning values to Cell Arrays
You are overwriting your matrices in every iteration. Also, you don't need those outer loops, since Matlab can do matrix operati...

más de 7 años hace | 1

| aceptada

Respondida
How to chang matrix size 81x81x30 to 81x81x32 by add row
You can use the cat function to concatenate arrays in a specific dimension: A=rand(81,81,30); B=rand(81,81); %or: B=zeros(siz...

más de 7 años hace | 1

Respondida
How does the figure window show a photo and close itself in matlab gui ?
Use this in a callback: close(gcbf) Example: f=figure(1);clf(1) uicontrol('parent',f,... 'units','normalized',... ...

más de 7 años hace | 0

Respondida
Determine own location in a live script
I see no indication that pwd doesn't work in live-scripts. If you can't guarantee the current folder, but do know the file name...

más de 7 años hace | 3

Respondida
how to return values from .mlapp to the .m caller
Since you only use a few objects, it would probably be easier to switch to GUI instead of an mlapp. If you use a figure, you ca...

más de 7 años hace | 1

Respondida
what does allchild(0) mean, specially why is the number 0 there
My guess is that this is equivalent to groot, similar to the file identifiers generated by fopen: "MATLAB® reserves file identi...

más de 7 años hace | 0

| aceptada

Respondida
How to compare 2 matrices by their values as well as it's position.
The code below first finds out which positions match for each row separately, and then tests if the matches are in the correct p...

más de 7 años hace | 0

| aceptada

Respondida
Graph plot always appears as a straight line
You are varying x, instead of r. The code below shows how you could edit your code to plot y as a function of r. l=0.5; i=22/7...

más de 7 años hace | 0

| aceptada

Respondida
Can't get the sqrt function to work correctly
The only edits that are obvious to me are the unnecessary call to hold and the fact you don't provide the x-axis values to the p...

más de 7 años hace | 2

| aceptada

Respondida
How can i detect max value and his index ?
Loop through the elements of your cell vector a, use the max function to find the maximum value for a, and the second output of ...

más de 7 años hace | 1

Respondida
Error: Function value and YDATA sizes are not equal
As a bold guess I'm going to assume you meant this: function s = EQEFit(J,x)% function for fitting s = J(1)./(4*x).*(sqrt(1+8*...

más de 7 años hace | 0

| aceptada

Respondida
Supplied objective function must return a scalar value
Depending on your input variable sizes, your code is not guaranteed to return the same size output as the input size. The docume...

más de 7 años hace | 2

Respondida
HOW TO READ DATA FROM 4 TEXT FILES SIMULTANEOUSLY LINE BY LINE AND FIND THE MEDIAN OF EACH LINE ?
This code should do the trick: fnames={'1OCT3AM.txt','1OCT6AM.txt','1OCT9AM.txt','1OCT12AM.txt'}; lastcol=zeros(1,numel(fnames...

más de 7 años hace | 0

| aceptada

Respondida
Why does matlab use such a high level of memory when it isn't doing anything?
Of course this also depends on how much memory you have in the first place. But the reason is the same for Matlab as it is for a...

más de 7 años hace | 0

Respondida
Switching between axes in GUI
With the rotate3d function you can enable and disable this mouse interaction for a specific axis or figure. I presume this will ...

más de 7 años hace | 0

Respondida
add image to gui
Have callback function that creates a figure that fills the entire screen. You can use the Position property when you create th...

más de 7 años hace | 1

Respondida
Is there a way to see if my code (written in 2018b) will work in another, older version of Matlab, like 2015b?
The only foolproof way I have found is actually trying it. You could also comb through the doc to check if the function behavio...

más de 7 años hace | 1

Respondida
How can I display an image on a point of the plot?
Instead of deleting and recreating those graphics every iteration, you could also update the XData and YData properties of the i...

más de 7 años hace | 0

| aceptada

Respondida
shouldn't there be two parallel lines on my plot?
There actually are two parallel lines, but you need to zoom in quite a lot. If you have a look at the output of the line below,...

más de 7 años hace | 0

| aceptada

Respondida
Generalizing an IF and FPRINTF expression
Since your actual question is much easier to understand, I'll try to answer that one. Below you will find two strategies that en...

más de 7 años hace | 0

| aceptada

Respondida
How to efficiently compare two matrix to get a single reference value?
I don't know if this is elegant enough for you, but it does work. TrueVal= [1 1 1 2 2 2 3 3 3 1 2]'; Predicted=[1 2 3 1 2 3 1...

más de 7 años hace | 2

| aceptada

Respondida
folder path difference in 'Windows' and 'Linux' system
This is not an inherent feature of Matlab, but of the operating system that runs Matlab. You can avoid this problem by not hard...

más de 7 años hace | 1

| aceptada

Respondida
how to create increasing number pyramid matrix?
In case that is the pattern you're looking for, here is the code that implements it: function M=create_stairs_matrix(N) M=zero...

más de 7 años hace | 0

| aceptada

Respondida
Why am I getting "Index in position 1 exceeds array bounds."?
Your image is already rgb, so you can skip that line in the first place. You do need to convert to double to have the same resul...

más de 7 años hace | 1

Cargar más