답변 있음
Error when using validatestring in inputParser addOptional
Hi Kevin, The problem lies in _validatestring_... from the docs: "the validatestring function returns the matching string in ...

대략 14년 전 | 0

| 수락됨

답변 있음
How can I skip lines when loading a text file?
Hi Baba, try importdata: importdata(FILENAME, DELIM, NHEADERLINES) loads data from ASCII file FILENAME, reading numeric ...

대략 14년 전 | 0

답변 있음
push button to change a variable
Hi Sven (nice name, btw), here's what I think you're looking for. Try making a myFunction.m file with the contents below, the...

대략 14년 전 | 0

| 수락됨

답변 있음
Reading a CSV file with header and times
Hi Steven, The string you've got for the dates and times aren't automatically recognised as simple dates - you'll need to rea...

대략 14년 전 | 1

| 수락됨

답변 있음
Numerical packing
Thank you Sean, Elige, for your responses, and thanks Walter for naming the problem I'd posed. Even after seeing it as a "knapsa...

14년 초과 전 | 0

| 수락됨

질문


Numerical packing
Hi all, here's a quick one. I've got an array and a limit: A = [235 235 235 234 235 235 234 234 234 220 280 215 234] lim = ...

14년 초과 전 | 답변 수: 5 | 2

5

답변

답변 있음
changing color and x-axis ticks in barplot
JW, try this: h = bar(rand(1,3)) set(gca,'XTickLabel',{'One','Two','Three'}) Setting different colours for each bar is a l...

14년 초과 전 | 2

답변 있음
how to use output indexes from the MAX function
Hi Patrick, I think this is what you want to do: arrSz = [5 6 7]; % Size of matrix cube1 = 10*rand(arrSz);...

14년 초과 전 | 1

| 수락됨

답변 있음
Matrix Sum
You can (and possibly should, depending on what you want to do next) turn your N 3-by-3 matrices into a single 3-by-3-by-N matri...

14년 초과 전 | 0

답변 있음
Imagesc & plot matrix
Salvatore, try this: Im = [1.0000 0.7944 0.7361 0.8205 0.4192 0.7944 1.0000 0.8663 0.6780 0.3435 ...

14년 초과 전 | 1

| 수락됨

답변 있음
Filling the objects found by canny edge
Kasia, I wrote the following, which does what (I think) you're looking for: I = imread('di-HQA6.jpg'); BW = bwareaopen(a...

14년 초과 전 | 0

| 수락됨

답변 있음
Return the number of rows of an array of cell data
If your cell contains strings (and not numeric data), just use *strcmp*: [row,col] = find(strcmp('Temp Height (density)', a...

14년 초과 전 | 0

| 수락됨

답변 있음
creating an image using a matrix
Raldi, try this: % Define the image size and where you want the circle rows = 50; cols = 50; radius = 20; center = [2...

14년 초과 전 | 2

| 수락됨

답변 있음
Replace nested loops?
A small time-drain will be the fact that inside the loop, the *overlap* variable gets constantly resized. In the MATLAB editor, ...

14년 초과 전 | 0

| 수락됨

답변 있음
creating biomorph
As far as I'm aware, the "biomorphs" have not been implemented yet in MATLAB. There have been other Dawkins' evolutionary MATLAB...

14년 초과 전 | 1

| 수락됨

답변 있음
strings, while loop help
Chris, try this: word = 'MyMatlab'; masked = repmat('*', size(word)); wrongGuesses = 0; wordGuessed = false; while w...

14년 초과 전 | 1

| 수락됨

답변 있음
replace elements of a vector
Hi Tiina, try this. It uses *find* and *arrayfun* to replace the zero-values of A with the nearest preceding non-zero value: ...

14년 초과 전 | 1

답변 있음
Display a variable and its units
You can use *fprintf* as follows: X = 25; fprintf('The answer is %d ft/lb\n', X) If your answer will not be a nice round n...

14년 초과 전 | 5

답변 있음
Finding the indices of the elements of one array in another
There are a few options to get the indices you are looking for. The following output indices (idx) preserve the order in A of th...

14년 초과 전 | 20

| 수락됨

답변 있음
Isopleth
Hi Karen, do you mean that you'd like to make a contour plot? You can try this (from the docs for *contour()*): Z = peaks; ...

14년 초과 전 | 0

| 수락됨

답변 있음
How do I fix a improper index matrix reference error
Here's how to debug such a problem: Type into the command line: dbstop if error Then, run your program. MATLAB will *stop* ...

14년 초과 전 | 0

답변 있음
Centroid Location is incorrect when edited in actual image data
One place where the code does something different to what I think you intended is here: blackwhite(centroids(:,1),centroids(:...

14년 초과 전 | 1

| 수락됨

답변 있음
interpolating missing data
Let's start with your data. data = [1 2330000 5.92275000000000e-06 36.2000000000000 2 52900000 2.79773000000000e-07 35.2000...

14년 초과 전 | 0

| 수락됨

답변 있음
Calculating and extracting data from three dimensional array
Almost there, Michael. Try this to average your two years: average = mean(testdata,3) This will average your testdata over t...

14년 초과 전 | 0

| 수락됨

답변 있음
about saving the numerical value and string altogether
Hi Liangjian, try this to join your cell and numbers: myCell = {'asf','qwe';'wer','two';'opi','oei'}; myNums = rand(3,1); ...

14년 초과 전 | 0

| 수락됨

답변 있음
Finding the position of the 1st,2nd and 3rd max value in a matrix
Hi Amin, try this: [sortedX, sortedInds] = sort(X(:),'descend'); top3 = sortedInds(1:3) And if you want to get the (i,j) r...

14년 초과 전 | 8

답변 있음
?? Error using ==> mrdivide Matrix dimensions must agree.
*Rc* is empty (it gets initialised as a global variable but nothing is assigned to it), but it's used in your *calc=...* calcula...

14년 초과 전 | 0

| 수락됨

답변 있음
ginput is turning off mouse cursor
Does the code by any chance rely on window events such as buttondownfcn, buttonmotionfcn, etc? *ginput()* has the annoying behav...

14년 초과 전 | 0

| 수락됨

답변 있음
Want to limit the lines of output. (for example, output after every 1000 iterations)
Hi Brian, your loop has a number of places where arrays are growing inside a loop. I believe this is the main reason why your co...

14년 초과 전 | 0

| 수락됨

답변 있음
deawing 3d vector lines
Hi Eve, you can use the following to draw a line from your original point in the direction specified. pt = [4 3 2] % Your p...

14년 초과 전 | 0

더 보기