已回答
copy a line from a txt to other txt
Hi! count = 1; tline = fgetl(fid01); while ischar(tline) count = count + 1; disp(tline) if count == 3 fpr...

11 years 前 | 0

| 已接受

已回答
Reshaping (M,N)-matrix to (M,1)-matrix
Hi! So your resulting matrix is a vector. right? Try this mat10 = ones(size(A, 1), 1) * 10.^((size(A, 2)-1):-1:0); ...

11 years 前 | 0

已回答
OOP-Performance problems in accessing large arrays in class properties
To answer myself: It seems that this problem occurs only if the class is a handle class ...

11 years 前 | 0

已回答
using checkboxes to select planets used in planetary motion code
Hi! Let's say you have 9 planets and 9 checkboxes. You need a logical vector of length 9. For each checkbox you define a call...

11 years 前 | 0

已回答
how to model a collision between two particles?
Hi! If you already found a distance below some value, do you know both planets involved? If so you just add in your matrix bo...

11 years 前 | 0

提问


OOP-Performance problems in accessing large arrays in class properties
Hi! I have a problem with accessing arrays that are properties of a class. I attached a sample class. In this class just one ...

11 years 前 | 3 个回答 | 2

3

个回答

已回答
how to do it using matlab.
Hi! Trapeziod rule means you add both values on the right and left of your discretisation, multiply with the distance and tak...

11 years 前 | 0

已回答
Pre-allocate memory gives zeros all the time, how to avoid?
Hi! Maybe your missing 10 because the first two rows are in the wrong order?

11 years 前 | 0

已回答
how to do plotting with different colors in same figure?
Hi! If you plot like plot(x,y) and y is a matrix, you get plots with different color automatically. But you can do so...

11 years 前 | 7

| 已接受

已回答
how do i generate a 1X4 matrix with until the sum of the matrix =100
Hi! Another way may be to create 4 random numbers, take what is missing upto 100 and add to the numbers: % random nu...

11 years 前 | 0

已回答
Search a text in dat file
Hi! % read in file fid = fopen('filename.dat'); FC = textscan(fid, '%s', 'Delimiter', '\n'); fclose(fid); FC = ...

11 years 前 | 0

已回答
Slicing tables into n columns and loops
Hi! Your data in an array is something like data = row(:, 2:end); You do not have to write the columns to separate va...

11 years 前 | 0

已回答
How can I return a set of values in an array from a function file?
Hi! First you may create an empty array like yf = zeros(countmax, 1); This gives you an array of maximum size. In you...

11 years 前 | 0

已回答
Intersection points of multiply lines?
Hi! Take a look at the great pages of Paul Bourke: <http://paulbourke.net/>. You can find a matlab code for the distance of t...

11 years 前 | 0

| 已接受

已回答
How to obtain code coverage
Hi! Do you know the profiler? This is what you need. Look in the documentation on how to profile a script/function. This give...

11 years 前 | 1

已回答
parsing integers from directory list
Hi! What du you have? An array of strings or a cell array? Are the numbers always in front of the file name? Suppose you h...

11 years 前 | 0

| 已接受

已回答
How to test the times cost of each part in a program
Hi! Use the profiler, located under "Tools" in the menu bar.

11 years 前 | 0

| 已接受

已回答
how to get rid of imaginary numbers, after a root.
Hi! What do you expect, physically? Your trajectory is a parabola with negative prefactor in front of t^2. So, the apex is th...

11 years 前 | 0

已回答
Help with textscan classifier
Hi! You can write C{1} = char(C{1}); This way you get a character array with each line corresponding to an atom type...

11 years 前 | 0

已回答
read in only certain columns of big text file
Hi! I'll try an answer for my short example: 1 2 s 4 5 a 5 a 4 c d 6 f i 9 8 d g 10 i n (all tab separated!) ...

11 years 前 | 0

已回答
How do I write a for loop to calculate the difference between two points?
Hi! You store your entered user input in a matrix, say N. As you wrote N is of dimension n*2. The distance of a point from...

11 years 前 | 0

已回答
Write plot data in loop to file
Hi! Look at the commands fopen fprintf fclose to write to a file. You may use the open/close commands before/af...

11 years 前 | 0

已回答
How to create a custom dynamic colormap?
Hi! You can use the command "colormap" to create color maps. The built-in colormaps can be scaled dynamically, like colo...

11 years 前 | 0

| 已接受

已回答
How to from my vector coordinate to fit my meshgrid matrix?
Hi! Your looking for the "reshape" function to reshape your intensity "I": Imatrix = reshape(I, 25, 5)

11 years 前 | 1

| 已接受

已回答
Calling the same function from within the function??
Hi! For Fortran77 programs recursive functions (or subroutines) are not possible, as a standard compiler gives you a compile ...

11 years 前 | 1

已回答
matlab display string in multiple lines
strvcat({'shdujfhdkjshfkjsdhkjfhkjdshfkj', ... 'hsdkjfhkjsdhkjfhkjdshkfhskdhfk', ... 'shdkjfhskjfdhs'})

11 years 前 | 2

已回答
how to make matlab pause when it running the coding
Hi! Use one of the commands "pause" or "input".

11 years 前 | 2

已回答
how to display a matrix with negative values as a image
There are many ways of doing this # take the absolute value with "abs" # shift all values so that you don't have negatives a...

11 years 前 | 0

已回答
how can I open the folder from desktop using matlab code?
Hi! You get the users directory in Windows with [~, userdir] = system('echo %USERPROFILE%') The desktop folder is in ...

11 years 前 | 0

已回答
message box in the code
Hi! I don't use magbox, but for formatted messages in command window, look at <http://www.mathworks.com/matlabcentral/fileexc...

11 years 前 | 0

加载更多