how can I use the clipboard function to directely save this string array on workspace WITHOUT OPENING THE IMPORT WIZARD

조회 수: 3 (최근 30일)
  댓글 수: 6
per isakson
per isakson 2019년 4월 17일
Doc says:
data = clipboard('pastespecial') imports the clipboard contents into an array using uiimport
AMINE EL MOUATAMID
AMINE EL MOUATAMID 2019년 4월 17일
I solve the problem
actually uiimport creat a temprary text file and paste on it the data from clipboard in one line.
then the code that generated by import tool changes the data from that line( of text file) to a specific dataArray.
I add this function to the code ( txt=clipboard('paste');) txt is a 1*1 ( like the line of temrary text file)
delimiter = '\t';
%% Format for each line of text:
% column1: text (%s)
% column2: text (%s)
% column3: text (%s)
% column4: text (%s)
% column5: text (%s)
% column6: text (%s)
% For more information, see the TEXTSCAN documentation.
formatSpec = '%s%s%s%s%s%s%[^\n\r]';
%% Read columns of data according to the format.
txt = clipboard('paste');
dataArray = textscan(txt, formatSpec, 'Delimiter', delimiter, 'TextType', 'string', 'ReturnOnError', false);
%% Create output variable
DATA = [dataArray{1:end-1}];
%% Clear temporary variables
clearvars delimiter formatSpec dataArray txt ;
thank you all for your help

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by