Answered
Extracting certain lines from a text file containing both characters and numbers
Presuming records (including blank lines) are as above, fid=fopen('HB.txt'); data=cell2mat(textscan(fid,'%f%f','headerlines',...

7 years ago | 0

Answered
How do I split a sing column .txt file by line?
Again, I'd suggest there's no need to actually create multiple text files to do this...several options exist in MATLAB; the simp...

7 years ago | 0

| accepted

Answered
How to make heatmap y-axis based on column names, not column values
data = [0 280 1170 0; 62 0 0 0]; VariableNames = {'colA', 'colB', 'colC', 'colD'}; rowid= {'rowA', 'rowB'}; hHM=heatmap(rowid...

7 years ago | 0

| accepted

Answered
how to avoid scientific notation when dealing with large integers?
Well, in base MATLAB you can't have more than >> intmax('uint64') ans = uint64 18446744073709551615 >> which is only...

7 years ago | 1

Answered
Problem in plotting the string variable
Nobody seems to have stumbled onto the easy answer as of yet...leaving the variable as a string when it is clearly a categorical...

7 years ago | 0

Answered
Getting values from a for loop when specific condition met
break is like drawing the "Go To Jail" card in Monopoly--you "go directly to jail, do not pass GO, do not collect $200". Here w...

7 years ago | 0

| accepted

Answered
Controlled Random Generator based off of two columns
function x=trafficX(RP,LO) % returns random count of X within upper limit RP but evenly divisible factor with lower limit LO %...

7 years ago | 0

| accepted

Answered
How to sort a matrix's columns by using indexes
See doc sortrows Not clear which array it is you wish sorted but mayhaps can accomplish directly -- altho the auxiliary array ...

7 years ago | 0

Answered
how to save all iteration output to plot graph later ?
In bending(i) = depl(1,:); you don't have but one index dimension on LHS in which you're trying to store a vector... Before the...

7 years ago | 0

Answered
Switching an array of Vectors from Cartesian to Spherical Coordinates
The documentation syntax is pretty clear-- "[azimuth,elevation,r] = cart2sph(x,y,z) transforms corresponding elements of the Ca...

7 years ago | 0

Answered
Question on Plotting from Cell Array
Dereference the cell array with the curlies "{}" for i=1:size(CA,2) scatter3(CA{i}(:,1),CA{i}(:,2),CA{i}(:,3)) if i==1,h...

7 years ago | 0

Answered
Plot polyfit R-squared
Because >> fittedXA(1),fittedXA(end) ans = 10 ans = 20 >> and that's what you plotted as the abscissa for some re...

7 years ago | 0

| accepted

Answered
Sorting Table Data by Groups of Rows
If the number of missing values is always 9, then extract the time column to a vector and t=datatable(:,1); % retrieve th...

7 years ago | 0

Answered
matlab table from for loops
A table may not be the best for this purpose but iiuc what you're asking for would be something like Nrows=100; Num_of_Banks=r...

7 years ago | 1

| accepted

Answered
Problem with plotting dates
Use readtable and maybe detectImportOptions first. Then, plot is datetime-aware, so you just call plot with the two variables.....

7 years ago | 0

Answered
Geoscatter point size in km
I don't have the mapping TB so can't experiment, but looks like <geobubble> would be better suited to the purpose as it does hav...

7 years ago | 0

Answered
Can I pass complex numbers from C++ to Matlab using feval or similar?
See mxCreateNumericMatrix for C interface. It can create a complex array. I suppose there's also a C++ version but "I know nut...

7 years ago | 0

| accepted

Answered
Loop for mutliple (but variable) number of plots on multiple pages
Figure out how many figures you need a priori... nplots = 13; pperfigure=12; nfigures=ceil(nplots/pperfigure); nUp=pperfigur...

7 years ago | 0

| accepted

Answered
Finding the sum of every nth row ( n is not fixed)
You'll have to introduce a day variable...by locating the positions where the hour returns to 0 if is always a 0-hour reading o...

7 years ago | 0

| accepted

Answered
I have multiple equations that depend on a specific value and would like matlab to ask the user which equation to use and what the specific value is and then print that value but it's giving me trouble.
Do something more like: materials={'BK7','Fused Silica','Soda Lime','Borofloat','Air','NOA61'}; [material,ok] = listdlg('Promp...

7 years ago | 0

Answered
How to neatly alternate between two different statements at different intervals
counter=0; Limit=10; for i=1:100 counter=counter+1; if counter<=Limit disp('A') else disp('B') counter...

7 years ago | 0

| accepted

Answered
Help parsing predictably messy data
function getdata=a1(fname) % read file sections, return as cell array of sections for subsequent use fid=fopen(fname,'r'); ...

7 years ago | 0

| accepted

Answered
Finding first rightmost non-zero column of a matrix?
Same solution as the other except search from the other end... find(any(A),1,'last') I think Azzi's solution there doesn't fin...

7 years ago | 0

| accepted

Answered
Extract columns from multiple csv files
targetColumn=3; % don't bury magic numbers, use input() to set, maybe... rootdir = 'C:\Work\TESTIN...

7 years ago | 0

Answered
To generate alternate 0's and 1's
One brute force way-- B=[]; for i=1:numel(A) B=[B (1-mod(i,2))*ones(1,A(i))]; end

7 years ago | 1

Answered
How to solve "Matrix dimensions must agree" getting from Matlab.
OK...still a little unclear but I think I've got enough of a picture to at least lay out the general idea. It'd be a lot easier...

7 years ago | 0

Answered
Data Linking And value reassignment for variables
I presume the "~-0" clause is to not eliminate i==j? Or can there be actual identical matches elsewhere? Either way the first...

7 years ago | 0

| accepted

Answered
Troubleshooting Import big excel file
>> t=readtable('export.csv'); >> whos t Name Size Bytes Class Attributes t 45x255 ...

7 years ago | 1

| accepted

Answered
How to solve "Matrix dimensions must agree" getting from Matlab.
if ('difficult = 0-back') & ('sleepstate = SD') is bad syntax on many fronts. First you've built a quoted string by usin...

7 years ago | 0

Answered
Help concatenating a table row to a specific excel spreadsheet?
outputTable=table(VarNameStr,Screen_Grasp_Average,Grasp_Release_Average,difference); writetable(outputTable,D:\LocationName\Dat...

7 years ago | 0

| accepted

Load more