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

11 years ago | 0

| accepted

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

11 years ago | 0

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

11 years ago | 0

| accepted

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

11 years ago | 0

Answered
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 ago | 0

| accepted

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

Question


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 ago | 3 answers | 2

3

answers

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 7

| accepted

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

| accepted

Answered
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 ago | 1

Answered
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 ago | 0

| accepted

Answered
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 ago | 0

| accepted

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

Answered
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 ago | 0

| accepted

Answered
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 ago | 1

| accepted

Answered
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 ago | 1

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

11 years ago | 2

Load more