Answered
how to run the m-file several times
It is not entirely clear to me what you try to achieve. If you want to load s from different mat files, you can do so using ...

10 years ago | 0

Answered
Help on conversion of data
With 4 bits you can code 32 numbers, like the integers from 0 to 31. You cannot convert double precision numbers between 0 and 1...

10 years ago | 0

Answered
How can I extract the last rows of specific columns of a text file
Read the data from file, ignoring 1 header line: data = cell2mat(textscan(fopen('a.txt'), '%f%f%f', 'headerlines', 1)); ...

10 years ago | 0

| accepted

Answered
Error using fgets Invalid file identifier. Use fopen to generate a valid file identifier.
Add if fid == -1 error('Cannot open file.') end You probably misspelled txtfile or it is not in the current direc...

10 years ago | 0

| accepted

Answered
Rearranging column of m by 1 matrix.
reshape(reshape(D, 2, [])', 1, [])

10 years ago | 0

Answered
How to delete the nth element from all the variables in my workspace?
x = whos; n = 2; for i=1:numel(x) eval([x(i).name '(' int2str(n) ')=[];']) end

10 years ago | 1

| accepted

Answered
Inverting and reshaping matrix which includes NaNs
You can rearrange the matrix by reversing the order of the non-NaN elements in each row such that the first column represents th...

10 years ago | 0

| accepted

Answered
If 'variable' is an indexed variable, performance can be improved using logical indexing instead of FIND
mpc.bus(mpc.bus(:,2)==3, 2) = 1; mpc.bus(mpc.bus(:,1)==mpc.gen(16,1), 2)=3;

10 years ago | 0

| accepted

Answered
Minimum y-value in each column
[~,idx] = max(X); Note that this returns 1 for columns that are all zero.

10 years ago | 0

| accepted

Answered
How to merge a contour plot with the image it is derived from
I failed to run your code, because >> contour(flipud(image)); Error using flipud (line 19) X must be a 2-D matrix. ...

10 years ago | 0

Answered
Wind rose - how to remove axis?
rose uses polar to plot, so you can remove the lines as you would do for polar <http://www.mathworks.com/matlabcentral/answers/...

10 years ago | 0

Answered
How to find least 8 values in a 1xN row matrix with their positions?
[~, ind] = sort(A); B = ind(1:8)

10 years ago | 0

Answered
how to write in the text file?
FN1 = 'JDA'; mn = 1:12; yr = 9:13; ext = '.ohh'; format = sprintf('%s%%03d%%02d%s\n', FN1, ext); ...

10 years ago | 0

| accepted

Answered
drawing a line using drawnow
axes axis([x_1-10 x_2+10 y_1-10 y_2+10]) hold on tmax = 5; for t=0:0.01:tmax plot(x_1+(x_2-x_1)*t/tmax, y_1+(...

10 years ago | 0

Answered
Find Diverging point of two arrays
You can compute the difference between both lines and find the point of divergence when the difference exceeds some threshold. ...

10 years ago | 0

Answered
Why I am getting an error like image Indexed CData must be size [MxN], TrueColor CData must be size [MxNx3]
<http://blogs.mathworks.com/steve/2011/09/27/digital-image-processing-using-matlab-reading-image-files/#5> Use 'Index' to add...

10 years ago | 0

Answered
Subscripted assignment dimension mismatch.
The variables G1, G2, G3, G4 are 1x365, so N1(i) + (G1+2*G2+2*G3+G4)*(h/6) is 1x365, and you try to assign this vector to a sing...

10 years ago | 0

Answered
How to create a loop in matlab codes?
theta = 23; % some starting value for i = 1:10 % run 10 times, for example a = exp(i); % sample computations for a, b,...

10 years ago | 0

| accepted

Answered
Please help me to fix Index exceeds matrix dimensions error.
splittedLine{2} seems to have fewer than 2 cells.

10 years ago | 0

Answered
Doubt in fprintf with double bar
\ starts many escape characters, like \n or \r. To print a single \, you have to use the escape character \\. fprintf(fileI...

10 years ago | 2

Answered
How can I get square brackets on a Swiss macbook keyboard?
alt-5 alt-6

10 years ago | 2

| accepted

Answered
Read batch data files
Use dir to get the names of the files and then use a for loop to process the files.

10 years ago | 0

| accepted

Answered
Histogram-based segmentation error
Use imshow(C, []) Because you scaled B with 255, the m values are within the range [0 255], so your C is in the range [...

10 years ago | 0

| accepted

Answered
fill a matrix from vectors
v1 = [1 2 3]; v2 = [3 4 5]; M = [v1; v2]

10 years ago | 0

Answered
problem with opening a 'ftp' link in Matlab
f = ftp('sidads.colorado.edu') data = mget(f, 'pub/DATASETS/nsidc0032_ease_grid_tbs/global/2013');

10 years ago | 0

| accepted

Answered
Problem with dimension of a vector
For cont == 7, the expression x(j,i) >= front is always false so funVal(cont,j) = exp(-rho*tauStar(1,j))*(pStar(1,j)-c); ...

10 years ago | 0

Answered
How do I use csvwrite in order to give me the data in a column and NOT in a single comma-separated line?
If the data is a column vector, it is printed as such csvwrite('test.txt', (1:5)') >> type test.txt 1 2 3 ...

10 years ago | 0

| accepted

Load more