How to create a password protected zip file using matlab?

Query is on : create a password protected zip file using matlab
I already used as below:
7z a archive.7z -psecret *.mat
But I am getting error: Error: Unexpected MATLAB expression. (Used Matlab R2017b)

2 Comments

Recommend encrypting file before zipping.
Sorry I modified my earlier comment:
7z a archive.7z -psecret *.mat
I was getting error.
Error: Unexpected MATLAB expression. (Used Matlab R2017b)
What do I have to do to encrypt *.mat file

Sign in to comment.

Answers (1)

! 7z a archive.7z -psecret *.mat
or
system('7z a archive.7z -psecret *.mat')

4 Comments

I tried both suggestions. But I am getting the message:
'7z' is not recognized as an internal or external command,
operable program or batch file.
I also tried with full path where 7z is installed as below:
system('C:\Program Files\7-Zip\7z.exe a archive5.7z -psecret *.mat')
But it is not correct as I am getting similar error:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
It worked, with following way:
system('"C:\Program Files\7-Zip\7z.exe" a arc.7z -psecret *.mat')
Using an exact path like you did is often a good idea for reliability... on any one system... but unfortunately not always portable.

Sign in to comment.

Categories

Find more on Scope Variables and Generate Names in Help Center and File Exchange

Products

Release

R2017b

Asked:

on 6 Jun 2020

Commented:

on 7 Jun 2020

Community Treasure Hunt

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

Start Hunting!