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

plus de 14 ans il y a | 0

| A accepté

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

plus de 14 ans il y a | 0

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

plus de 14 ans il y a | 0

| A accepté

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

plus de 14 ans il y a | 1

| A accepté

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

plus de 14 ans il y a | 0

| A accepté

Question


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

plus de 14 ans il y a | 5 réponses | 2

5

réponses

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

plus de 14 ans il y a | 2

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

plus de 14 ans il y a | 1

| A accepté

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

plus de 14 ans il y a | 0

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

plus de 14 ans il y a | 1

| A accepté

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

plus de 14 ans il y a | 0

| A accepté

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

plus de 14 ans il y a | 0

| A accepté

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

plus de 14 ans il y a | 2

| A accepté

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

plus de 14 ans il y a | 0

| A accepté

Réponse apportée
creating biomorph
As far as I'm aware, the "biomorphs" have not been implemented yet in MATLAB. There have been other Dawkins' evolutionary MATLAB...

plus de 14 ans il y a | 1

| A accepté

Réponse apportée
strings, while loop help
Chris, try this: word = 'MyMatlab'; masked = repmat('*', size(word)); wrongGuesses = 0; wordGuessed = false; while w...

plus de 14 ans il y a | 1

| A accepté

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

plus de 14 ans il y a | 1

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

plus de 14 ans il y a | 5

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

plus de 14 ans il y a | 20

| A accepté

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

plus de 14 ans il y a | 0

| A accepté

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

plus de 14 ans il y a | 0

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

presque 15 ans il y a | 1

| A accepté

Réponse apportée
interpolating missing data
Let's start with your data. data = [1 2330000 5.92275000000000e-06 36.2000000000000 2 52900000 2.79773000000000e-07 35.2000...

presque 15 ans il y a | 0

| A accepté

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

presque 15 ans il y a | 0

| A accepté

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

presque 15 ans il y a | 0

| A accepté

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

presque 15 ans il y a | 8

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

presque 15 ans il y a | 0

| A accepté

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

presque 15 ans il y a | 0

| A accepté

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

presque 15 ans il y a | 0

| A accepté

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

presque 15 ans il y a | 0

Charger plus