Respondida
Change the color of streamslice
load wind figure h = streamslice(x,y,z,u,v,w,[],[],[5]); axis tight set( h, 'Color', [0 0 0] ) % or set( h, 'C...

más de 9 años hace | 0

| aceptada

Respondida
If statement / conditional operations
(arbgrad<0) is a logical vector of the same length as arbgrad. BB3(arbgrad<0) which you try to assign it to is a ve...

más de 9 años hace | 1

| aceptada

Respondida
how to find minimum number in array other than 0 and 1 ?
min( A( A > 1 ) ) seems to work fine. You don't need to and it with an A > 0 since that is implicit from A > 1. If you di...

más de 9 años hace | 1

Respondida
Problem graphing a piece-wise function in R2016a??
It is very simple when you think about it in components. You can create y piece-wise and then plot a graph as normal. e.g. ...

más de 9 años hace | 0

| aceptada

Respondida
Is it possible to interpret legends differently?
Yes, when you create a legend either set 'Interpreter' when you create it or use hLegend = legend(...) to keep a handle ...

más de 9 años hace | 0

| aceptada

Respondida
How do you rewrite the nested if statement as a loop?
lowLims = -1:0.1:0.9; highLims = -0.9:0.1:1; count = sum( x > lowLims & x <= highLims ); should work though I rep...

más de 9 años hace | 0

| aceptada

Respondida
Get multiples item from listbox
selected_file=contents( get(hObject,'Value') ) should work. Or just selected_file = hObject.String( hObject.Value ); ...

más de 9 años hace | 0

Respondida
how to find distance between consecutive points
sqrt( sum( abs( diff( A ) ).^2, 2 ) ) There may be a builtin function that does it to, but something so simple I tend to ju...

más de 9 años hace | 2

| aceptada

Respondida
How to flip a line upside down?
figure; hAxes = gca; x = [1 2 3]; y = [2 2.5 3.5]; plot( hAxes, x, y ) set( hAxes, 'YDir', 'reverse' ) % O...

más de 9 años hace | 0

| aceptada

Respondida
How to convert cell into array of floating point numbers only?
splitStrings = cellfun( @(x) strsplit( x, ' ' ), myCell, 'UniformOutput', false ); vals = cellfun( @(x) str2double( x{1} ),...

más de 9 años hace | 1

| aceptada

Respondida
How to Import Parameters from XML file into Matlab Workspace
xmldoc = xmlread( filename ); x0 = str2double( xmldoc.getElementsByTagName( 'x0' ).item( 0 ).getFirstChild.getNodeValue...

más de 9 años hace | 1

| aceptada

Respondida
The GUID tutorial is not correct ?
str is a cell array of characters - one cell for each option in the popup. So you use { } to get the characters out of the chos...

más de 9 años hace | 1

| aceptada

Respondida
How can I make the figure created by the plot function be an object?
h = plot( ... ) will return a handle to the object that is plotted, although the data in this will be the same as you gave ...

más de 9 años hace | 0

| aceptada

Respondida
Automatically creating an array of variables and assigning to a function with changing number of outputs
[x, y, z] = ind2sub( [3,4], 9 ); works even though the size of the input is 2d, you just get z = 1. Likewise if you use n ...

más de 9 años hace | 0

Respondida
String select specific positions
a = [ Numbers{NumbersSelect} ];

más de 9 años hace | 1

Respondida
how can i resolve it not enough input arguments?
Pass the right number of arguments in when you call it. Don't just hit the big green 'Run' button, call it from command line or...

más de 9 años hace | 0

| aceptada

Respondida
Why does my new version of MATLAB not have 'stlread' function?
stlread is from the file exchange: <https://uk.mathworks.com/matlabcentral/fileexchange/22409-stl-file-reader> I assume yo...

más de 9 años hace | 2

| aceptada

Respondida
Plotting an image, how to show origin tick marks?
[0, 0] is not visible on an image axes normally. The origin is at [0.5 0.5] because the first pixel is centred at [1 1], extend...

más de 9 años hace | 0

Respondida
Different values in matrix and in the plot of image
You have to be careful with X,Y and rows, columns when indexing into a matrix. To get the value reported as X,Y you need to inde...

más de 9 años hace | 1

| aceptada

Respondida
bug on sprintf?
The help suggests this if you want true integers from floats: wv=0:0.2:4; for i=1:length(wv) sprintf('%.2d', round( w...

más de 9 años hace | 0

Respondida
Keeping colorbar max and min in scatter3 during for loop
doc caxis If you set e.g. caxis( hAxes, [0 1] ) then it will stay that way. If it doesn't you can also set ca...

más de 9 años hace | 0

| aceptada

Respondida
How to transfer a string input from GUI to another matlab file for processing
You have two options (well, at least). One is to use the 'source' variable instead of SEQ_2 because that is what it represent...

más de 9 años hace | 0

Respondida
How do use different colormaps for 2 plots in the same figure?
colormap( hAxes, 'hot' ) works in recent releases, where hAxes is your axes handle. I can't remember which release it was ...

más de 9 años hace | 0

Respondida
Wait bar or any indication of progress when loading a .mat file
I created my own busy cursor class for things like this (though it just changes the cursor to the windows busy cursor, with some...

más de 9 años hace | 3

Respondida
Adding an x-axis changes output of graph
Almost all plotting-related commands in Matlab come with an overload that takes the axes handle as first argument. Use it!! Do...

más de 9 años hace | 1

| aceptada

Respondida
why is my program not working ?
x is a vector so x <-1 is also going to be a vector of logicals. In your case neither of your if statements returns true so y i...

más de 9 años hace | 0

Respondida
what if I need more decimal digits in calculated results ? ( e.g. 50 or 80 decimal digits )
You probably have to use the Symbolic Math Toolbox for more accuracy though I don't have this so am not familiar with its usage....

más de 9 años hace | 0

Respondida
Unit Testing: How to treat errors as failures
doc matlab.unittest.qualifications.Assumable rather than using assert in a unit test will cause the test to be filtered rat...

más de 9 años hace | 0

Respondida
Want to convert .MAT to .TXT
doc fprintf should be able to do what you want, but you'll have to put together the format specification yourself and work ...

más de 9 años hace | 0

Respondida
How do I force the output format of arrayfun() to be "short"?
lbl1 = arrayfun(@(lo,hi) sprintf('(%g,%g)', lo, hi), axlim(:,1), axlim(:,2), 'UniformOutput', 0) The help... doc sprin...

más de 9 años hace | 2

| aceptada

Cargar más