回答済み
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...

13日 前 | 1

回答済み
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...

13日 前 | 1

| 採用済み

回答済み
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...

13日 前 | 0

回答済み
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...

14日 前 | 2

| 採用済み

回答済み
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...

14日 前 | 0

回答済み
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...

14日 前 | 0

回答済み
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 ...

14日 前 | 0

| 採用済み

回答済み
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...

14日 前 | 0

回答済み
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...

14日 前 | 0

回答済み
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...

15日 前 | 1

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

15日 前 | 0

| 採用済み

回答済み
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);...

15日 前 | 0

| 採用済み

回答済み
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...

15日 前 | 0

| 採用済み

回答済み
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...

16日 前 | 0

| 採用済み

回答済み
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)/(...

16日 前 | 2

回答済み
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...

16日 前 | 0

| 採用済み

回答済み
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(...

16日 前 | 1

回答済み
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...

16日 前 | 0

| 採用済み

回答済み
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 ...

17日 前 | 1

回答済み
"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...

21日 前 | 0

| 採用済み

回答済み
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...

21日 前 | 1

回答済み
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);...

21日 前 | 0

| 採用済み

回答済み
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...

21日 前 | 0

| 採用済み

回答済み
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...

27日 前 | 0

| 採用済み

回答済み
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...

30日 前 | 0

| 採用済み

回答済み
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...

30日 前 | 0

| 採用済み

回答済み
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...

約1ヶ月 前 | 0

| 採用済み

回答済み
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...

約1ヶ月 前 | 0

回答済み
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...

約1ヶ月 前 | 0

| 採用済み

回答済み
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...

約1ヶ月 前 | 1

| 採用済み

Load more