Answered
Splitting number from its units
Try >> cac = regexp( '0.7mcg/kg/hr', '([\d\.]+)|(\D+)', 'tokens' ); >> cac{:} ans = '0.7' ans = '...

9 years ago | 1

| accepted

Answered
Could someone please show me how to add time data?
Here is one way of doing it. I use four copies of you example file for this test. %% tic folderspec = 'h:\m\cssm'; ...

9 years ago | 0

| accepted

Answered
Remove or ignore certain row while reading from text files?
A quick and dirty solution: Delete the row, which causes trouble. Try >> tic, preTaskFinal( 'h:\m\cssm\SS Escape EPA Hwy Ca...

9 years ago | 1

| accepted

Answered
'ABC'-'A' Considered Harmful
To explicitly convert to numeric before doing arithmetic is faster. (Real reason: I find 'abc'-'a' confusing.:) *Try* ...

9 years ago | 2

Answered
How to extract data from strcture ?
If you by _"node"_ mean what is called field in Matlab %% create a stucture with 101 fields sas = cell2struct( nu...

9 years ago | 0

Answered
Reading data from .txt file skipping lines and others
Try %% fid = fopen( 'rc204afixed.txt' ); ca1 = textscan( fid, '', 'Headerlines', 4, 'CollectOutput',true ); ca2 = ...

9 years ago | 1

| accepted

Answered
Input string to a matrix or a cell
Cell array >> data = cell( 1, 3 ); >> data{2} = cell(3,6); >> data{2}{2,4} = 'Hello World'; or >> data{2}(2,4...

9 years ago | 0

| accepted

Answered
How do I make the element zero, if its adjacent column element is zero?
Try >> is_zero = A(:,2)==0; >> A(is_zero,1)=0; >> A A = 0 0 0 0 10 6 0...

9 years ago | 1

| accepted

Answered
How to concatenate 3D cells arrays
Try >> R = cssm() R = {61x1 cell} {61x1 cell} {61x1 cell} {61x1 cell} {61x1 cell} ...

9 years ago | 1

| accepted

Answered
fwrite to fread changes data completely!
This works for me on R2016a,Win7,64b. (Replacing *|real*8|* by *|double|* doesn't change that.) >> cssm( rand(1,1000) ) ...

9 years ago | 0

| accepted

Answered
Help to solve a regexp problem
Test this >> str = sprintf(' %% this is a comment\n %% and this\n'); >> cac = regexp( str, '[ ]*%[^\n]+', 'match' ...

9 years ago | 1

| accepted

Answered
It is possible to save the all struct consecutively using Neural Network
There are many ways to achieve _"... save all data for each routine made? (tr,weight, etc..)"_, one of which store the result an...

9 years ago | 0

| accepted

Answered
Pre-allocate not helping
These two line takes most of the time <</matlabcentral/answers/uploaded_files/55699/Capture.PNG>> &nbsp and this on...

9 years ago | 0

| accepted

Answered
How can I find and remove the nonzero duplicates in each column of a matrix
Given * _"matrix of integers"_ * _"the first row is always the column number"_ * _"the duplicate, if exists, is always t...

9 years ago | 0

| accepted

Answered
How to extract data from multiple HDF5 files
*Assumptions:* * all h5-files are in one folder, e.g. *|c:\my\data|* * all h5-files in that folder shall be read * all h5-f...

9 years ago | 0

| accepted

Answered
How to split a matrix based on indexing
Two ways, *|arrayfun|* and *|for-loop|* %% M = repmat( transpose([1:16]), [1,11] ); ix1 = [1,5,12]; ix2 = [ix1(2:...

9 years ago | 0

| accepted

Answered
Add more simple spam filters
I've deleted several spams over the last couple of days. Most (all?) of them contained a body text, which was copied from a lega...

9 years ago | 1

Answered
Creating new variable in a subfunction .m file
No globals needed. Try %% in main R = nan( N, 5 ); % pre-allocate memory for jj = 1 : N R(jj,:) = sub(); en...

9 years ago | 2

Answered
Sampling according to difference in function value
A homemade approach %% Sample data that better fits the tooltip display x = randi([1,100],[1,20]); % 100 is magic num...

9 years ago | 0

| accepted

Answered
What's the problem about this loop?
Test >> nan==nan ans = 0 Replace kontrola(i)==NaN by isnan(kontrola(i)) and run your code....

9 years ago | 0

| accepted

Answered
Breakpoint is cleared w/o using "clear all"
I believe that you are seeing a bug in Matlab. I experience problems with breakpoints on a regular basis (in R2013a and olde...

9 years ago | 0

Answered
Do i need to permute arrays before applying high level HDF5 functions?
_"Am I doing something wrong?"_ &nbsp No, that's the way Matlab works. %% data_in = randi([0,9],[8,4]); h5create('c:\...

10 years ago | 0

Answered
How do I apply a function to each cell in a matrix which is dependent on surrounding cells?
*My guess:* %% A = [1 2 1; 2 3 2; 4 1 2]; %% xy2 = (.25*x(n-1)y + .5*xy1 + .25*x(n+1)y) B = cat( 2, zeros(size(A,...

10 years ago | 0

Answered
Problem with updating a modified text file
To remove the old version from memory, add clear('name_of_your_m_file') directly after (or before) the line where you ...

10 years ago | 1

| accepted

Answered
Importing data using textscan from a large dataset
Who created this file? I know there isn't a strict csv-standard. Anyhow after some trial and error, I came up with this format s...

10 years ago | 0

| accepted

Answered
how to give a correct file name
Replace people = sprintf('%d%0d.txt' , p); expression = sprintf('%d%02d.txt' , e); fname = strcat(people,expression) ...

10 years ago | 1

| accepted

Answered
How to Export Table to Text File without quotations marks for each element?
AFAIK: that's the way *|writetable|* works. Try this alternative, which prints the cell array with *|fprintf|* and avoids *|...

10 years ago | 0

Answered
How can I pass control back to the MATLAB command prompt after keyboard command?
I failed to make my system, R2016a on Win7, behave as you describe. On the contrary it behaves exactly as you want it to do. ...

10 years ago | 0

Answered
how to open gui files of matlab 7.04 in matlab r2015b
See * <http://uk.mathworks.com/help/matlab/graphics-changes-in-r2014b.html Graphics Changes in R2014b> * <http://uk.mathwor...

10 years ago | 0

| accepted

Answered
What's the best way to import multiple matrices from a file?
If the entire text file easily fits in memory, I think this example show the best way/approach. >> cac = cssm() cac = ...

10 years ago | 0

Load more