Réponse apportée
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...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
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)~=...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 1

Réponse apportée
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'...

plus de 7 ans il y a | 0

Réponse apportée
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 ...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 1

Réponse apportée
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',... ...

plus de 7 ans il y a | 0

Réponse apportée
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...

plus de 7 ans il y a | 3

Réponse apportée
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...

plus de 7 ans il y a | 1

Réponse apportée
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...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 2

| A accepté

Réponse apportée
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 ...

plus de 7 ans il y a | 1

Réponse apportée
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*...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 2

Réponse apportée
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...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 0

Réponse apportée
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 ...

plus de 7 ans il y a | 0

Réponse apportée
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...

plus de 7 ans il y a | 1

Réponse apportée
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...

plus de 7 ans il y a | 1

Réponse apportée
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...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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,...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 2

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 7 ans il y a | 1

Charger plus