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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

Domanda


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

oltre 10 anni fa | 3 risposte | 2

3

risposte

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 7

| accettato

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 1

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

oltre 10 anni fa | 0

| accettato

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

oltre 10 anni fa | 0

| accettato

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

quasi 11 anni fa | 0

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

quasi 11 anni fa | 0

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

quasi 11 anni fa | 0

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

quasi 11 anni fa | 0

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

quasi 11 anni fa | 0

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

quasi 11 anni fa | 0

| accettato

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

quasi 11 anni fa | 1

| accettato

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

quasi 11 anni fa | 1

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

quasi 11 anni fa | 2

Carica altro