matlab - audioread produces verbose output and wont stop [duplicate] - matlab

This question already has an answer here:
Suppressing Output MATLAB
(1 answer)
Closed 7 years ago.
I am using matlab and trying to plot a spectrogram from an audio file. The problem is that audioread itself gives me a huge output of numbers in the console, wont stop scrolling and will never reach the spectrogram command. The numbers look like this, and it scrolls for years.
-0.0190 -0.0387
-0.0687 -0.4357
-0.0253 -0.1229
0.0561 0.3603
0.1308 0.3627
0.1283 0.1240
0.0004 0.0327
How do I switch it off?

You are probably missing a semicolon.
Does this help?
http://uk.mathworks.com/help/matlab/matlab_prog/symbol-reference.html#bsgigzp-47

Related

How to make MATLAB start the xtick from the very beginning? [duplicate]

This question already has answers here:
limit the axes for plotting in Matlab [duplicate]
(2 answers)
Closed 3 years ago.
I am plotting with MATLAB and make MATLAB to put 15 xticks on the x-label. The first xtick doesn't start from the very beginning, though.
xticks([1:15]);
xticklabels({'(1, 2)','(1, 3)','(2, 3)','(1, 4)','(2, 4)','(3, 4)','(1, 5)','(2, 5)','(3, 5)','(4, 5)',...
'(1, 6)', '(2, 6)', '(3, 6)', '(4, 6)', '(5, 6)'});
All you need is: xlim([1:15]);

Reading an image in MATLAB [duplicate]

This question already has answers here:
How to read images from folders in matlab
(3 answers)
Closed 6 years ago.
I want to load an image in MATLAB :
f=imread('fulldirectory');
m=size(f);
printf('m');
MATLAB shows me this error when I attempt to run it:
"Error using imread (line 349)"
Can anyone help me?
Imread function needs a file format, e.g., jpg.
You can use one of the following MATLAB codes.
f = imread('ngc6543a.jpg');
f = imread('ngc6543a', 'jpg');
Also, just omit the semicolon (;) from your second line of your codes, if you want to know the dimension of the image. MATLAB will display the size of the image.
m=size(f)
MATLAB has some test images such as ngc6543a.jpg and you can try my code in your MATLAB.

Creating multiple column legend [duplicate]

This question already has answers here:
How can I customize the positions of legend elements?
(5 answers)
Closed 4 years ago.
I use MATLAB to draw a graph. The legends are too big and cover a part of the graph. I want to split the entries of the legend in two columns. I saw some solutions on the net that explain how to change the functions to display the legend in multiple columns. However, my program reads the data from an Excel file and their solutions don't work for me. Could anybody please help me to solve this issue? Sorry if my question is naive, I'm not good in MATLAB.
Here is my code:
A=xlsread('C:\temp.xlsx','A1:A10');
B=xlsread('C:\temp.xlsx','B1:B10');
C=xlsread('C:\temp.xlsx','C1:C10');
D=xlsread('C:\temp.xlsx','D1:D10');
E=xlsread('C:\temp.xlsx','E1:E10');
F=xlsread('C:\temp.xlsx','F1:F10');
G=xlsread('C:\temp.xlsx','G1:G10');
plot(A,B,A,C,A,D,A,E,A,F,A,G)
hold on;
axis([10 100 -10 0])
xlabel('length')
ylabel('BER')
legend('AAAAAAAAAA','BBBBBBBBBB','CCCCCCCCCC','DDDDDDDDDD','EEEEEEEEEEE','FFFFFFFFFF')
Here are two different links to matlab-files that should solve your problem:
ColumnLegend
GridLegend
The creation of the legend should be independent on how you read your data, so the fact that you read your data from Excel should not give you any problems!

What is the new syntax of flops(0) and qp() in Matlab 2014? [duplicate]

This question already has answers here:
MATLAB/octave count number of operations (flops)
(2 answers)
Closed 7 years ago.
I am running an old Matlab code, i.e., Version 5, and it seems some of the syntaxes have been changed in the newer versions of Matlab. I have Matlab 2014 and Want to know what is the new syntax for the codeflaps.
First I have some problems about flaps command which seems to be removed from newer version. So what I have as a code about it is bellow, Just the necessary parts are posted, Please tell me how can I modify it for running on new matlab.
flops(0) % and few lines after
initial_flops = flops;
Flop = [Flop, flops];
fprintf(' Number of flops in initial calculations: %i\n\n',initial_flops);
disp(' beta #flops(in K) ')
disp(Flop_report)
net_flops
Also, I would like to know is qp() an old function in Matlab 5?
If yes what is its alternative in New versions of Matlab?
The function no longer exists, to benchmark code use timeit or profile.

MATLAB: how to get the list of figures [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I get the handles of all open figures in MATLAB
The situation is following. I run a couple of tests, which plot a lot of figures. I would like to convert them to pdf and compile into one file. Since each time I may get different type of plots and different number of plots, I need to get the list of all figures in current matlab session or workspace. Is this doable?
Thanks
h = get(0,'Children');
will put the "handles" to the figures you currently have in the variable h. get(handle) and set(handle,...) are gigantically useful in general. The handle 0 points at the root of the display, so all the figures on the display are the root's Children.