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

plus de 7 ans il y a | 1

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

plus de 7 ans il y a | 1

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 2

| A accepté

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

plus de 7 ans il y a | 0

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

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

plus de 7 ans il y a | 0

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

plus de 7 ans il y a | 1

Réponse apportée
make cell and put number on it
You can do it like this: n=20; result=num2cell(1:n);

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 2

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 1

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 1

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

plus de 7 ans il y a | 1

| A accepté

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

plus de 7 ans il y a | 1

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

plus de 7 ans il y a | 1

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

| A accepté

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

plus de 7 ans il y a | 0

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

plus de 7 ans il y a | 0

| A accepté

Réponse apportée
Area between two curves that intersect
You are using the loop incorrectly, and you don't need it anyway. You are doing an integration over a single point, which is unl...

plus de 7 ans il y a | 2

| A accepté

Charger plus