Answered
how to modify contrast in multiple dicom images using slider GUIDE
You can use the callback of the slider to adjust the caxis. In my FEX submission WindowLevel I do something similar, but with d...

7 years ago | 0

| accepted

Answered
Excel and MATLAB connection
You can use xlsread to read data from Excel in your code. I would avoid the use of ActiveX whenever you can avoid it. You can fi...

7 years ago | 1

Answered
Average of a single element in an array
The best method depends on how you have generated your array. I will show two examples below. %example 1: only integers A=rand...

7 years ago | 1

| accepted

Answered
How can I rotate the lines on an image
You can use code similar to that below. I changed the step size to 30 degrees to make it more clear what is happening. clc cen...

7 years ago | 0

| accepted

Answered
how to sum of each row according to values values in given function
You can do something like the code below. You could use a for loop instead of the call to cellfun, but as you can see, you don't...

7 years ago | 2

| accepted

Answered
how to estimate bright channel for color image in Matlab??
Below you find 2.5 strategies. The first should be a lot faster, especially for larger images. With the last it is easier to see...

7 years ago | 0

Answered
Please advise me on how to improve the efficiency of this code?
You could use an explicit dialog box to avoid any confusion: answer = questdlg(... 'Do you want to try again?', ...%questi...

7 years ago | 0

| accepted

Answered
Working with dicom images
You need to convert to either a double or a int16 (before applying the subtraction). The latter only has a maximum half as high ...

7 years ago | 0

| accepted

Answered
Using a While loop to determine number greater than a constant
I'm a bit hesitant to provide you with a complete working solution, since you mention it is homework. I will give you some advic...

7 years ago | 0

Answered
Why reading in csv files will not work for me.
Why aren't you trying something like this? files = dir('*.csv') Q = numel(files); data=cell(Q,1); for n=1:Q % Read in C...

7 years ago | 0

Answered
distributing two values in 3d array
You could also do the following: L=60; % Number of columns b=25; % Number of rows w=25; %the depth of the 3D lattice K_f1=5e...

7 years ago | 1

Answered
make cell and put number on it
You can do it like this: n=20; result=num2cell(1:n);

7 years ago | 0

| accepted

Answered
reducing resolution of an image
You can use the imresize function to resample images: A=uint8(randi(255,1666,1200,3));%generate random 2MP image dims=size(A);...

7 years ago | 0

| accepted

Answered
Title a plot with variable 'char'
Your function declaration must match the use, so you need to put this line at the top of your function instead: function [figur...

7 years ago | 0

| accepted

Answered
Update my plot each time parameters change
You should set the callback function of your slider to update the plot. If you need more specific help, attach your code (and fi...

7 years ago | 0

| accepted

Answered
How to optimize this equation:Collection/ward ( Y) = 1.55495763465296E-06-1.57475099626936E-09*C1+ 1.23047294575684E-10*C3+ 1499.99999957807*C4
This is something you could solve algebraically: C4=(1.55495763465296E-06-1.57475099626936E-09*C1+ 1.23047294575684E-10*C3-y)/(...

7 years ago | 2

Answered
How do I find the maximum and minimum value(s) of my randomly generated bar chart, and set a specific color for the max and min value(s)?
The code below puts 2 extra bar plots with the desired colors. It also avoids loops. %n_throws=input("choose a number of throws...

7 years ago | 0

| accepted

Answered
Is it possible to store jpg images in an array to use in a function?
To give an example of how you could do it with a cell array: images=cell(2,10); ratios=zeros(1,size(images,2)); for n=1:size(...

7 years ago | 1

Answered
code for conditional statement
You can use code similar to that below. It is easier to put the input data in a cell arrray than to have different names for the...

7 years ago | 0

| accepted

Answered
can not plot the graph and there is samething wrong on my script, can anyone checkit
Your code doesn't do what you think it does. You could see that by looking at your variables: they have become scalars, instead ...

7 years ago | 1

Answered
"set" VS "=" assignment
The set syntax is older than the object notation. The advantages of the set syntax are that you can use it in older Matlab rele...

7 years ago | 1

| accepted

Answered
Calculate the Area Between Two Curves
This code should help. It assumes you want to count all the area between the two lines as positive. The more crossings there are...

7 years ago | 1

Answered
Display Value in Text Box
You need to transform your value to text using either sprintf or num2str: a=trapz(cP6-cP7); str=sprintf('Area Swept: %d',a);...

7 years ago | 1

| accepted

Answered
How do I verify user input from prompt/inputdlg and go back to same prompt if input is invalid?
One of the ways to solve this is with a recursive function. (another solution you could choose is a while loop) function matrix...

7 years ago | 0

| accepted

Answered
How to use waitbar while copying images from folders and subfolders
What I would do is first make a list of all sources and targets, and then do the actual copying in a loop like this h_wait=wait...

7 years ago | 0

| accepted

Answered
Link to MATLAB documentation
If you type this doc prob.normaldistribution.random at least you will get to the correct doc page. You'll have to scroll (or u...

7 years ago | 0

| accepted

Answered
How to detect first 50 white pixels from right side of a binary image?
You can use find to get the indices from the left, so the only thing you need to do is flipping the image and convert the col in...

7 years ago | 0

| accepted

Answered
Display figure returned by .m function into GUI axis
(This is an earlier comment reposted as answer. I would suggest giving Jan's answer an upvote if you think he helped to get to a...

7 years ago | 0

| accepted

Answered
Facing a problem in calculating the sum of digits of 100!.
This is due to how computers store digits. You will need to rethink your method for big numbers: clc %don't use clear, use fun...

7 years ago | 0

Answered
Exclude one row from calculation
The easiest way to do this is with a logical vector: Reference=2; ABC=[1;2;3;4;5;6]; L=ABC~=Reference; logodds(1:5,:)=log(AB...

7 years ago | 0

| accepted

Load more