Beantwortet
Help with csv data preparation
Hi! In your cell array the second and third entry of every line are numeric values already. You may split the string in the f...

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
How can I delete certain rows of a matrix based on specific column values?
Hi! Suppose you have matrix M: % logical vector for rows to delete deleterow = false(size(M, 1), 1); % loop ov...

etwa 11 Jahre vor | 0

Beantwortet
Help in importing csv file
Hi! You may just load your file and process it afterwards like % load file fid = fopen('data.csv', 'r'); FC = ...

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
Printing to specific lines in a text file
Hi! It is not difficult if the same columns are text and numbers. You can simply loop over all data and printf with "fprintf"...

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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); ...

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

Frage


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

etwa 11 Jahre vor | 3 Antworten | 2

3

Antworten

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

etwa 11 Jahre vor | 0

Beantwortet
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?

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 7

| akzeptiert

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

| akzeptiert

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

etwa 11 Jahre vor | 1

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

etwa 11 Jahre vor | 0

| akzeptiert

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

etwa 11 Jahre vor | 0

| akzeptiert

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

Beantwortet
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!) ...

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

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

etwa 11 Jahre vor | 0

| akzeptiert

Beantwortet
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)

etwa 11 Jahre vor | 1

| akzeptiert

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

etwa 11 Jahre vor | 1

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

etwa 11 Jahre vor | 2

Mehr laden