Risposto
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...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 1

| accettato

Risposto
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)~=...

oltre 7 anni fa | 1

| accettato

Risposto
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...

oltre 7 anni fa | 1

Risposto
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'...

oltre 7 anni fa | 0

Risposto
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 ...

oltre 7 anni fa | 1

| accettato

Risposto
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...

oltre 7 anni fa | 1

| accettato

Risposto
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...

oltre 7 anni fa | 1

Risposto
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',... ...

oltre 7 anni fa | 0

Risposto
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...

oltre 7 anni fa | 3

Risposto
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...

oltre 7 anni fa | 1

Risposto
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...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 2

| accettato

Risposto
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 ...

oltre 7 anni fa | 1

Risposto
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*...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 2

Risposto
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...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 0

Risposto
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 ...

oltre 7 anni fa | 0

Risposto
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...

oltre 7 anni fa | 1

Risposto
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...

oltre 7 anni fa | 1

Risposto
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...

oltre 7 anni fa | 0

| accettato

Risposto
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,...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 2

| accettato

Risposto
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...

oltre 7 anni fa | 1

| accettato

Risposto
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...

oltre 7 anni fa | 0

| accettato

Risposto
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...

oltre 7 anni fa | 1

Carica altro