Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Problems with Strings!

$
0
0
On 6/25/2013 2:16 PM, Mary wrote:
...
> I'm having two problems:
...

> (I'm hoping to allow the user to copy and paste a list of usernames from
> a word doc/spreadsheet, and paste them when prompted for an input)
>
> 2.) generating the spreadsheets for some reason MATLAB refuses to
> acknowledge my column headers when using xlswrite. I even followed a
> reccomended tutorial from MATLAB for how to set things up!
>
> This is what I have so far!
>
>
...

> ***PROBLEM 1. HERE***
> x = strcat(input('Enter usernames for current cohort','s'));
> userNames = strsplit(x)
...

Play around w/ the following and see if any joy ensues...

s=inputdlg('input: ','Input Box',3);

If numlines>1 it appears will return a cell array of inputs from a
clipboard paste. If I open a Word doc and put, three text lines in it
and copy them I get

 >> s=inputdlg('input: ','Input Box',3)
s =
     [3x5 char]
 >> s{:}
ans =
Name1
Name2
Name3
 >>

If numlines==1 then it pastes them all on the one line.

doc inputdlg

...

> *** PROBLEM 2 HERE***
> %Stores Variable Data in a Matrix
> colHeader = {'Number Full Completion','Number Partial Completion Less
> than Five','Number Partial Completion Less than Ten','Number Partial
> Completion More than Ten','Number No Login'};
> stats(1) = (totalCompleted);
> stats(2) = (partialUnderFive);
> stats(3) = (partialUnderTen);
> stats(4) = (partialOverTen);
>
> %% Saves Data into an xls spreadsheet
> saveName = ['Module_Status_Report' date]
> xlswrite(saveName,log,1)
> xlswrite(saveName,stats,2,'A2')
> xlswrite(saveName,colHeader,2,'A1')
> end

I've never used xlswrite() so no help there, really, sorry...

I note the following on the "Data to write" expansion...

> to write, specified as a two-dimensional numeric or character
> array, or, if each cell contains a single element, a cell array.
>
> If A is a cell array containing something other than a scalar numeric
> or a string, then xlswrite silently leaves the corresponding cell in
> the spreadsheet empty.

Don't know if that's related to your problems/troubles/symptoms or not,
but is suggestive methinks...

--

Viewing all articles
Browse latest Browse all 19628

Trending Articles